@snagset/server 0.1.63 → 0.1.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/dashboard/assets/{CompositeItem-D7THTrjT.js → CompositeItem-CNlNRLwm.js} +1 -1
- package/static/dashboard/assets/{CompositeList-CeLQBvjs.js → CompositeList-CDfO6SCy.js} +1 -1
- package/static/dashboard/assets/{ConfirmDialog-Ca4nB0gY.js → ConfirmDialog-B5-FUf01.js} +1 -1
- package/static/dashboard/assets/{CopyButton-baCHDy5v.js → CopyButton-CDVY09FZ.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-DU1NZyaa.js → FieldItemContext-D_hbvXzX.js} +1 -1
- package/static/dashboard/assets/{InstallTag-COg-5qzp.js → InstallTag-DutQruP1.js} +1 -1
- package/static/dashboard/assets/InstanceRows-BrXrOXxa.js +1 -0
- package/static/dashboard/assets/McpTokens-BnhNB_C0.js +1 -0
- package/static/dashboard/assets/{Picker-BGAVkehH.js → Picker-BvdKGeU8.js} +2 -2
- package/static/dashboard/assets/{SaveState-v3jQ1_XP.js → SaveState-DrWU77oO.js} +1 -1
- package/static/dashboard/assets/_-DwwKoA7B.js +1 -0
- package/static/dashboard/assets/_app-CYfFCBBL.js +1 -0
- package/static/dashboard/assets/{_app-BynrR78o.js → _app-DalVfhNg.js} +1 -1
- package/static/dashboard/assets/{_app-Bhuo6WVN.js → _app-MqqZ5rHF.js} +2 -2
- package/static/dashboard/assets/activity-B1fOkSrs.js +1 -0
- package/static/dashboard/assets/{arrow-left-DuT_fV3X.js → arrow-left-B4-bJVcO.js} +1 -1
- package/static/dashboard/assets/{avatar-f4OTBv_u.js → avatar-B-4Lv0hf.js} +1 -1
- package/static/dashboard/assets/{badge-1x3gEOj5.js → badge-Cwf-GPv8.js} +1 -1
- package/static/dashboard/assets/{check-DnU_QrcS.js → check-26YOtWVN.js} +1 -1
- package/static/dashboard/assets/{chevron-down-CBtD71Qj.js → chevron-down-OinKSKsq.js} +1 -1
- package/static/dashboard/assets/{chevron-right-C5AqW-nF.js → chevron-right-Dh7TD2kW.js} +1 -1
- package/static/dashboard/assets/{copy-C0sdzqxc.js → copy-DqhiNOHN.js} +1 -1
- package/static/dashboard/assets/{createBaseUIEventDetails-4JZNAnON.js → createBaseUIEventDetails-BlUeVOHL.js} +1 -1
- package/static/dashboard/assets/{dialog-CIAPdljP.js → dialog-CjX41K4h.js} +2 -2
- package/static/dashboard/assets/{dropdown-menu-CCSKS7Vl.js → dropdown-menu-BejmUTVa.js} +2 -2
- package/static/dashboard/assets/{forgot-Chc103l7.js → forgot-Cv_EPbZy.js} +1 -1
- package/static/dashboard/assets/{getPseudoElementBounds-B9DhGoL1.js → getPseudoElementBounds-087ogDm1.js} +1 -1
- package/static/dashboard/assets/{image-off-Cq8_byd8.js → image-off-BsOmKpjU.js} +1 -1
- package/static/dashboard/assets/index-CUBD0DcL.js +172 -0
- package/static/dashboard/assets/{inertValue-9Ojj3uf7.js → inertValue-BxLh7N1J.js} +1 -1
- package/static/dashboard/assets/invite-DrxWT0UW.js +1 -0
- package/static/dashboard/assets/{label-qbrDzIaf.js → label-BoGrNcZ0.js} +1 -1
- package/static/dashboard/assets/{layout-grid-CFzUr6JC.js → layout-grid-D1FcD4G3.js} +1 -1
- package/static/dashboard/assets/me-DeblO6Os.js +1 -0
- package/static/dashboard/assets/{plus-EpJ2hlJL.js → plus-ChodljzA.js} +1 -1
- package/static/dashboard/assets/{reset-BDWJBuHV.js → reset-DoB5fAkF.js} +1 -1
- package/static/dashboard/assets/{s._site-D81hm-l9.js → s._site-Xu1MbYF_.js} +1 -1
- package/static/dashboard/assets/{s._site.comments-DQ3i0QSi.js → s._site.comments-63OF736E.js} +8 -8
- package/static/dashboard/assets/s._site.reviewers-BZ6tbe9V.js +1 -0
- package/static/dashboard/assets/s._site.settings-Bx21kvsO.js +1 -0
- package/static/dashboard/assets/{setup-D5LmXbcW.js → setup-AHjI1DnF.js} +1 -1
- package/static/dashboard/assets/{sign-in-Bl09bVJL.js → sign-in-D-Y_lran.js} +1 -1
- package/static/dashboard/assets/{sign-up-B1XMq41Y.js → sign-up-B8RiXKrs.js} +1 -1
- package/static/dashboard/assets/sites-BcEIT4Tw.js +1 -0
- package/static/dashboard/assets/studio-BxUhJp0u.js +1 -0
- package/static/dashboard/assets/{studio-DRa8t2VU.js → studio-Dg6dFTZ5.js} +1 -1
- package/static/dashboard/assets/studio.index-N5sIdor3.js +1 -0
- package/static/dashboard/assets/{studio.integrations-CtUgczTe.js → studio.integrations-ZAlVFGVw.js} +2 -2
- package/static/dashboard/assets/studio.members-r1I_P9vv.js +6 -0
- package/static/dashboard/assets/studio.plan-B5CWlvB1.js +1 -0
- package/static/dashboard/assets/{sun-BSvDJaml.js → sun-B2KoVsUv.js} +1 -1
- package/static/dashboard/assets/{switch-BXyi-44q.js → switch-DmO3bJxP.js} +1 -1
- package/static/dashboard/assets/{table-D6MQ3yct.js → table-D3lWzaas.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-DWswad3y.js → useAriaLabelledBy-BVVmb5Zj.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-B90MJ7He.js → useBaseQuery-BBU42uTr.js} +1 -1
- package/static/dashboard/assets/{useCompositeItem-DGreOIU-.js → useCompositeItem-BZX9S0sx.js} +1 -1
- package/static/dashboard/assets/useQuery-CGx36E5q.js +1 -0
- package/static/dashboard/assets/useRender-CNreHlDo.js +1 -0
- package/static/dashboard/assets/useScrollLock-DV4rQnvf.js +1 -0
- package/static/dashboard/assets/{useValueChanged-DQAqpQ0y.js → useValueChanged-BcwdNwDJ.js} +1 -1
- package/static/dashboard/assets/{users-DuEepqIK.js → users-BxyUqa0S.js} +1 -1
- package/static/dashboard/assets/{welcome-DwOgRPZN.js → welcome-9qfwvdaq.js} +3 -3
- package/static/dashboard/assets/widget-signin-x6glMrne.js +1 -0
- package/static/dashboard/assets/you-C3HTpoDt.js +1 -0
- package/static/dashboard/assets/{zod-DF2MI65D.js → zod-qyf6R6J-.js} +1 -1
- package/static/dashboard/index.html +1 -1
- package/static/widget/build.json +2 -2
- package/static/widget/snag.js +1 -1
- package/static/widget/snag.runtime.js +1 -1
- package/static/dashboard/assets/InstanceRows-BmiUo_5h.js +0 -1
- package/static/dashboard/assets/McpTokens-CvESgbHd.js +0 -1
- package/static/dashboard/assets/activity-BfXjGG77.js +0 -1
- package/static/dashboard/assets/card-C1bRD7dG.js +0 -1
- package/static/dashboard/assets/index-DIf_7lV5.js +0 -162
- package/static/dashboard/assets/invite-DSynOAj4.js +0 -1
- package/static/dashboard/assets/me-cdROrEZn.js +0 -1
- package/static/dashboard/assets/parts-DnonT_sc.js +0 -6
- package/static/dashboard/assets/s._site.reviewers-BS-Kr36t.js +0 -1
- package/static/dashboard/assets/s._site.settings-CUhYg-Ye.js +0 -1
- package/static/dashboard/assets/sites-umID164r.js +0 -1
- package/static/dashboard/assets/studio-DR-PqCVa.js +0 -1
- package/static/dashboard/assets/studio.index-CzwRs37G.js +0 -1
- package/static/dashboard/assets/studio.members-B4I6YBkd.js +0 -6
- package/static/dashboard/assets/studio.plan-Z50-owr0.js +0 -1
- package/static/dashboard/assets/useQuery-CYC6DPXm.js +0 -1
- package/static/dashboard/assets/useRender-DP2er8v5.js +0 -1
- package/static/dashboard/assets/useScrollLock-DSPnO43v.js +0 -1
- package/static/dashboard/assets/widget-signin-C-VdT35d.js +0 -1
- package/static/dashboard/assets/you-NBZzam76.js +0 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as u,
|
|
1
|
+
import{E as u,aT as t,k as c}from"./index-CUBD0DcL.js";import{u as E}from"./useCompositeItem-BZX9S0sx.js";function A(e){const{render:d,className:l,style:C,state:s=u,props:o=t,refs:r=t,metadata:a,stateAttributesMapping:m,tag:p="div",...i}=e,{compositeProps:n,compositeRef:f}=E({metadata:a});return c(p,e,{state:s,ref:[f,...r],props:[n,...o,i],stateAttributesMapping:m})}export{A as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,e as L,f as g,
|
|
1
|
+
import{r as c,e as L,f as g,av as S,j}from"./index-CUBD0DcL.js";const k=c.createContext(void 0);function F(){return c.useContext(k)?.direction??"ltr"}const y=c.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function T(){return c.useContext(y)}function G(u={}){const{guess:o,label:e,metadata:s,textRef:p,index:t}=u,{register:i,unregister:a,subscribeMapChange:m,nextIndexRef:R}=T(),f=c.useRef(-1),[v,b]=c.useState(t==null&&o?()=>{if(f.current===-1){const l=R.current;R.current+=1,f.current=l}return f.current}:-1),I=t??v,h=c.useRef(null),E=c.useCallback(l=>{const C=h.current;C&&a(C),h.current=l,l&&i(l,{metadata:s??null,index:t??null,label:e,textRef:p})},[t,i,a,s,e,p]);return L(()=>{if(t==null)return m(l=>{const C=h.current?l.get(h.current)?.index:null;C!=null&&b(C)})},[t,m]),{ref:E,index:I}}function V(u){const{children:o,elementsRef:e,labelsRef:s,onMapChange:p}=u,t=g(p),[,i]=c.useState(!1),a=S(U).current,m=S(A).current,R=c.useRef(0),f=c.useRef(!0),v=c.useRef([]),b=c.useRef(null),I=g(()=>{f.current||(f.current=!0,i(n=>!n))}),h=g((n,d)=>{m.set(n,d),I()}),E=g(n=>{m.delete(n),I()}),l=g(n=>{const d=new Map;return e.current.length=0,s&&(s.current.length=0),n.forEach(r=>{d.set(r.element,{...r.registration.metadata??{},index:r.index}),e.current[r.index]=r.element,s&&(s.current[r.index]=r.registration.label!==void 0?r.registration.label:r.registration.textRef?.current?.textContent??r.element.textContent)}),R.current=e.current.length,d});function C(n){if(b.current?.disconnect(),b.current=null,typeof MutationObserver!="function"||n.length<2)return;const d=new MutationObserver(x=>{if(!z(x))return;let M=null;for(const w of n)if(w.isConnected){if(M&&D(M,w)>0){d.disconnect(),I();return}M=w}});b.current=d;const r=new Set;for(let x=1;x<n.length;x+=1){const M=_(n[x-1],n[x]);M&&r.add(M)}r.forEach(x=>d.observe(x,{childList:!0}))}const N=g(()=>{const[n,d]=W(m),r=l(n);C(d),v.current=n,f.current=!1,a.forEach(x=>x(r)),t(r)});L(()=>(f.current||l(v.current),()=>{e.current=[],s&&(s.current=[])}),[e,s,l]),L(()=>{f.current&&N()}),L(()=>()=>{b.current?.disconnect(),f.current=!0},[]);const O=g(n=>(a.add(n),()=>{a.delete(n)})),P=c.useMemo(()=>({register:h,unregister:E,subscribeMapChange:O,nextIndexRef:R}),[h,E,O,R]);return j.jsx(y.Provider,{value:P,children:o})}function A(){return new Map}function U(){return new Set}function W(u){const o=new Set,e=[],s=[];u.forEach((t,i)=>{if(!i.isConnected)return;const a=t.index,m={index:a??-1,element:i,registration:t};a===null?s.push(m):a>=0&&(o.add(a),e.push(m))});let p=0;return s.sort((t,i)=>D(t.element,i.element)),s.forEach(t=>{for(;o.has(p);)p+=1;t.index=p,e.push(t),p+=1}),o.size>0&&e.sort((t,i)=>t.index-i.index),[e,s.map(t=>t.element)]}function _(u,o){let e=u.parentElement;for(;e&&!e.contains(o);)e=e.parentElement;return e}function z(u){for(const o of u)for(let e=0;e<o.removedNodes.length;e+=1)if(o.removedNodes[e].isConnected)return!0;return!1}function D(u,o){return u.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}export{V as C,F as a,G as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,B as u}from"./index-
|
|
1
|
+
import{r as i,j as e,B as u}from"./index-CUBD0DcL.js";import{i as C,j as v,l as b,k as D,m as y,n as N}from"./dialog-CjX41K4h.js";import{I as k}from"./label-BoGrNcZ0.js";import{C as T}from"./check-26YOtWVN.js";import{C as B}from"./copy-DqhiNOHN.js";function F({open:l,onOpenChange:o,title:x,description:n,children:g,confirmLabel:h,confirmWord:s,busy:t=!1,onConfirm:j}){const[r,c]=i.useState(""),[d,m]=i.useState(!1),f=i.useId();i.useEffect(()=>{l&&c("")},[l]);const p=!s||r.trim()===s;return e.jsx(C,{open:l,onOpenChange:a=>{!a&&t||o(a)},children:e.jsx(v,{showCloseButton:!1,children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:a=>{a.preventDefault(),p&&!t&&j()},children:[e.jsxs(b,{children:[e.jsx(D,{children:x}),n&&e.jsx(y,{children:n})]}),g,s&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("p",{className:"m-0 flex flex-wrap items-center gap-1 text-sm font-medium",children:["Type",e.jsxs("button",{type:"button",disabled:t,title:"Copy the name",className:"inline-flex items-center gap-1 rounded-sm bg-muted px-1.5 py-0.5 font-semibold text-foreground hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring",onClick:()=>{navigator.clipboard?.writeText(s).catch(()=>{}),m(!0),setTimeout(()=>m(!1),1500),document.getElementById(f)?.focus()},children:[s,d?e.jsx(T,{className:"size-3.5 text-muted-foreground"}):e.jsx(B,{className:"size-3.5 text-muted-foreground"}),e.jsx("span",{className:"sr-only",children:d?" copied":" — copy"})]}),"to confirm"]}),e.jsx(k,{id:f,"aria-label":`Type ${s} to confirm`,value:r,autoComplete:"off",spellCheck:!1,disabled:t,onChange:a=>c(a.target.value)})]}),e.jsxs(N,{children:[e.jsx(u,{type:"button",variant:"outline",disabled:t,onClick:()=>o(!1),children:"Cancel"}),e.jsx(u,{type:"submit",variant:"destructive",loading:t,disabled:!p,children:t?"Working…":h})]})]})})})}export{F as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as t,B as c}from"./index-
|
|
1
|
+
import{r as n,j as t,B as c}from"./index-CUBD0DcL.js";import{C}from"./check-26YOtWVN.js";import{C as m}from"./copy-DqhiNOHN.js";function l({text:r,label:e="Copy",withText:s=!1,size:a="icon-sm",className:p}){const[o,i]=n.useState(!1);return t.jsxs(c,{type:"button",variant:"outline",size:s?"sm":a,className:p,"aria-label":o?"Copied":e,onClick:()=>{navigator.clipboard?.writeText(r).catch(()=>{}),i(!0),setTimeout(()=>i(!1),1500)},children:[o?t.jsx(C,{}):t.jsx(m,{}),s&&(o?"Copied":e)]})}export{l as C};
|
package/static/dashboard/assets/{FieldItemContext-DU1NZyaa.js → FieldItemContext-D_hbvXzX.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t}from"./index-
|
|
1
|
+
import{r as t}from"./index-CUBD0DcL.js";const e=t.createContext({disabled:!1});function r(){return t.useContext(e)}export{r as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,i as je,e as Z,f as _,k as oe,j as n,aJ as Ne,aj as Le,al as Oe,aG as ue,E as Ve,b4 as ze,h as re,o as He,B as Ke,b5 as Be}from"./index-DIf_7lV5.js";import{k as _e,c as Pe,C as pe,D as ge,d as Fe,u as we,m as $e,o as be,a as We,n as Ye,g as he}from"./createBaseUIEventDetails-4JZNAnON.js";import{C as ke,u as Je,a as Ue}from"./CompositeList-CeLQBvjs.js";import{i as Ge}from"./isElementDisabled-CwHw_lZC.js";import{a as qe,u as Qe,t as Xe,i as Ze,s as me,k as ve,h as le,e as ce,H as xe,E as Re,C as et,l as Ce,g as tt,f as nt,A as ye,m as Ie,n as Ee,o as Te,M as at}from"./inertValue-9Ojj3uf7.js";import{u as st}from"./useCompositeItem-DGreOIU-.js";import{C as ot}from"./check-DnU_QrcS.js";import{C as rt}from"./copy-C0sdzqxc.js";const Se=a.createContext(void 0);function fe(){const t=a.useContext(Se);if(t===void 0)throw new Error(je(64));return t}const ie={tabActivationDirection:t=>({"data-activation-direction":t})},it=a.forwardRef(function(o,r){const{className:C,defaultValue:i=0,onValueChange:j,orientation:u="horizontal",render:A,value:E,style:P,...w}=o,m=o.defaultValue!==void 0,O=a.useRef([]),[D,x]=a.useState(()=>new Map),[l,R]=_e({controlled:E,default:i,name:"Tabs",state:"value"}),y=E!==void 0,[s,T]=a.useState(()=>new Map),f=a.useRef(void 0),g=a.useCallback(p=>de(s,p),[s]),[V,L]=a.useState(()=>({previousValue:l,tabActivationDirection:"none"})),{previousValue:c,tabActivationDirection:I}=V;let e=I,d=!1;c!==l&&(e=Me(c,l,u,s),d=c!=null&&l!=null&&g(l)==null);const b=d?c:l,k=c!==b||I!==e;Z(()=>{k&&L({previousValue:b,tabActivationDirection:e})},[b,k,e]);const S=_((p,M)=>{const W=Me(l,p,u,s);M.activationDirection=W,j?.(p,M),!M.isCanceled&&R(p)}),H=_((p,M)=>{j?.(p,Pe(M,void 0,void 0,{activationDirection:"none"}))}),F=_((p,M)=>(x(W=>{const q=new Map(W);return q.set(p,M),q}),()=>{x(W=>{if(W.get(p)!==M)return W;const q=new Map(W);return q.delete(p),q})})),J=a.useCallback(p=>D.get(p),[D]),N=a.useCallback(p=>{for(const M of s.values())if(p===M.value)return M.id},[s]),h=a.useMemo(()=>({getTabElementBySelectedValue:g,getTabIdByPanelValue:N,getTabPanelIdByValue:J,onValueChange:S,orientation:u,registerMountedTabPanel:F,setTabMap:T,tabActivationDirection:e,value:l}),[g,N,J,S,u,F,T,e,l]),z=a.useMemo(()=>{for(const p of s.values())if(p.value===l)return p},[s,l]),$=a.useMemo(()=>{for(const p of s.values())if(!p.disabled)return p.value},[s]),K=a.useRef(!m),U=a.useRef(i),G=a.useRef(m),v=a.useRef(!1);Z(()=>{if(y)return;function p(X,ee){R(X),L({previousValue:X,tabActivationDirection:"none"}),H(X,ee),K.current=!1}if(s.size===0){v.current&&l!==null&&!f.current?.isConnected&&p(null,ge);return}v.current=!0,f.current=s.keys().next().value;const M=z?.disabled,W=z==null&&l!==null;if(!M&&l===U.current&&(G.current=!1),G.current&&M&&l===U.current)return;const q=K.current;if(M||W){const X=$??null;if(l===X){K.current=!1;return}let ee=ge;q?ee=pe:M&&(ee=Fe),p(X,ee);return}q&&z!=null&&(H(l,pe),K.current=!1)},[$,y,H,z,R,s,l]);const Q=oe("div",o,{state:{orientation:u,tabActivationDirection:e},ref:r,props:w,stateAttributesMapping:ie});return n.jsx(Se.Provider,{value:h,children:n.jsx(ke,{elementsRef:O,children:Q})})});function de(t,o){for(const[r,C]of t.entries())if(o===C.value)return r;return null}function Me(t,o,r,C){if(t==null||o==null)return"none";const[i,j,u]=r==="horizontal"?["left","left","right"]:["top","up","down"],A=de(C,t),E=de(C,o);if(A==null||E==null)return A!==E&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof o?o>t?u:j:"none";const P=A.getBoundingClientRect()[i],w=E.getBoundingClientRect()[i];return w<P?j:w>P?u:"none"}const Ae="data-composite-item-active",De=a.createContext(void 0);function lt(){const t=a.useContext(De);if(t===void 0)throw new Error(je(65));return t}const ct=a.forwardRef(function(o,r){const{className:C,disabled:i=!1,render:j,value:u,id:A,nativeButton:E=!0,style:P,...w}=o,{value:m,getTabPanelIdByValue:O,onValueChange:D,orientation:x,tabActivationDirection:l}=fe(),{activateOnFocus:R,registerTabResizeObserverElement:y,tabsListElement:s}=lt(),{highlightedIndex:T,onHighlightedIndexChange:f}=Ne(),g=we(A),V=a.useMemo(()=>({disabled:i,id:g,value:u}),[i,g,u]),{compositeProps:L,compositeRef:c,index:I}=st({metadata:V}),e=u===m,d=a.useRef(!1),b=a.useRef(null),k=_(v=>{b.current?.(),b.current=v?y(v):null});Z(()=>{if(d.current){d.current=!1;return}if(!(e&&I>-1&&T!==I))return;const v=s;if(v!=null){const B=$e(be(v));if(B&&We(v,B))return}i||f(I)},[e,I,T,f,i,s]);const{getButtonProps:S,buttonRef:H}=Le({disabled:i,native:E,focusableWhenDisabled:!0}),F=O(u),J=a.useRef(!1),N=a.useRef(!1);function h(v){D(u,Pe(Ye,v.nativeEvent,void 0,{activationDirection:"none"}))}function z(v){e||i||h(v)}function $(v){e||i||R&&(!J.current||N.current)&&h(v)}function K(v){if(e||i)return;J.current=!0,N.current=v.button===0;const B=be(v.currentTarget);function Q(){J.current=!1,N.current=!1,B.removeEventListener("pointerup",Q),B.removeEventListener("pointercancel",Q)}B.addEventListener("pointerup",Q),B.addEventListener("pointercancel",Q)}return oe("button",o,{state:{disabled:i,active:e,orientation:x,tabActivationDirection:l},ref:[r,H,c,k],props:[L,{role:"tab","aria-controls":F,"aria-selected":e,id:g,onClick:z,onFocus:$,onPointerDown:K,[Ae]:e?"":void 0,onKeyDownCapture(){d.current=!0}},w,S],stateAttributesMapping:ie})}),ut={...ie,...Xe},dt=a.forwardRef(function(o,r){const{className:C,value:i,render:j,keepMounted:u=!1,style:A,...E}=o,{value:P,getTabIdByPanelValue:w,orientation:m,tabActivationDirection:O,registerMountedTabPanel:D}=fe(),x=we(),{ref:l,index:R}=Je(),y=i===P,{mounted:s,transitionStatus:T,setMounted:f}=qe(y),g=!s,V=w(i),L={hidden:g,orientation:m,tabActivationDirection:O,transitionStatus:T},c=a.useRef(null),I=oe("div",o,{state:L,ref:[r,l,c],props:[{"aria-labelledby":V,hidden:g,id:x,role:"tabpanel",tabIndex:y?0:-1,inert:Ze(!y),"data-index":R},E],stateAttributesMapping:ut});return Qe({open:y,ref:c,onComplete(){y||f(!1)}}),Z(()=>{if(!(x==null||g&&!u))return D(i,x)},[g,u,i,x,D]),u||s?I:null}),ft=[];function pt(t){const{loopFocus:o=!0,orientation:r="both",grid:C,onLoop:i,direction:j,highlightedIndex:u,onHighlightedIndexChange:A,rootRef:E,enableHomeAndEndKeys:P=!1,stopEventPropagation:w,disabledIndices:m,modifierKeys:O=ft}=t,[D,x]=a.useState(0),l=C!=null,R=a.useRef(null),y=Oe(R,E),s=a.useRef([]),T=a.useRef(!1),f=u??D,g=_((e,d=!1)=>{if((A??x)(e),d){const b=s.current[e];me(R.current,b,j,r)}}),V=_(e=>{if(e.size===0||T.current)return;T.current=!0;const d=Array.from(e.keys()),b=d.find(S=>S?.hasAttribute(Ae))??null,k=b?e.get(b)?.index??-1:-1;if(k!==-1)g(k);else if(ve(d,f,m)){const S=le(d,{disabledIndices:m});ce(d,S)||g(S)}me(R.current,b,j,r)});Z(()=>{if(m==null||u!=null||!T.current)return;const e=s.current;if(ve(e,f,m)){const d=le(e,{disabledIndices:m});ce(e,d)||g(d)}},[m,u,f,s,g]);const L=_((e,d,b)=>i?i(e,d,b,s):b),c=_(e=>{const d=e.key===xe||e.key===Re;if(!et.has(e.key)||!P&&d||gt(e,O)||!R.current)return;const k=j==="rtl",S=k?Ee:Te,H=k?Te:Ee,F=r==="vertical"?ye:S,J=r==="vertical"?Ie:H,N=he(e.nativeEvent);if(N!=null&&Ce(N)&&!Ge(N)){const G=N.selectionStart,v=N.selectionEnd,B=N.value;if(G==null||e.shiftKey||G!==v||e.key!==J&&G<B.length||e.key!==F&&G>0)return}let h=f;const z=tt(s,m),$=nt(s,m);C!=null&&(h=C({disabledIndices:m,elementsRef:s,event:e,highlightedIndex:f,loopFocus:o,maxIndex:$,minIndex:z,onLoop:L,orientation:r,rtl:k}));const K=r!=="vertical"&&e.key===S||r!=="horizontal"&&e.key===ye,U=r!=="vertical"&&e.key===H||r!=="horizontal"&&e.key===Ie;P&&(e.key===xe?h=z:e.key===Re&&(h=$)),h===f&&(K||U)&&(o&&h===$&&K?(h=z,i&&(h=i(e,f,h,s))):o&&h===z&&U?(h=$,i&&(h=i(e,f,h,s))):h=le(s.current,{startingIndex:h,decrement:U,disabledIndices:m})),h!==f&&!ce(s.current,h)&&(w&&e.stopPropagation(),(l||d||K||U)&&e.preventDefault(),g(h,!0),queueMicrotask(()=>{s.current[h]?.focus()}))});return{props:{ref:y,onFocus(e){const d=R.current,b=he(e.nativeEvent);!d||b==null||!Ce(b)||b.setSelectionRange(0,b.value.length)},onKeyDown:c},highlightedIndex:f,onHighlightedIndexChange:g,elementsRef:s,onMapChange:V,relayKeyboardEvent:c}}function gt(t,o){for(const r of at)if(!o.includes(r)&&t.getModifierState(r))return!0;return!1}function bt(t){const{render:o,className:r,style:C,refs:i=ue,props:j=ue,state:u=Ve,stateAttributesMapping:A,highlightedIndex:E,onHighlightedIndexChange:P,orientation:w,grid:m,loopFocus:O,onLoop:D,enableHomeAndEndKeys:x,onMapChange:l,stopEventPropagation:R=!0,rootRef:y,disabledIndices:s,modifierKeys:T,highlightItemOnHover:f=!1,tag:g="div",...V}=t,L=Ue(),{props:c,highlightedIndex:I,onHighlightedIndexChange:e,elementsRef:d,onMapChange:b,relayKeyboardEvent:k}=pt({grid:m,loopFocus:O,onLoop:D,orientation:w,highlightedIndex:E,onHighlightedIndexChange:P,rootRef:y,stopEventPropagation:R,enableHomeAndEndKeys:x,direction:L,disabledIndices:s,modifierKeys:T}),S=oe(g,t,{state:u,ref:i,props:[c,...j,V],stateAttributesMapping:A}),H=a.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:e,highlightItemOnHover:f,relayKeyboardEvent:k}),[I,e,f,k]);return n.jsx(ze.Provider,{value:H,children:n.jsx(ke,{elementsRef:d,onMapChange:F=>{l?.(F),b(F)},children:S})})}const ht=a.forwardRef(function(o,r){const{activateOnFocus:C=!1,className:i,loopFocus:j=!0,render:u,style:A,...E}=o,{orientation:P,setTabMap:w,tabActivationDirection:m}=fe(),[O,D]=a.useState(0),[x,l]=a.useState(null),R=a.useRef(new Set),y=a.useRef(new Set),s=a.useRef(null);Z(()=>{if(typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>{R.current.forEach(I=>{I()})});return s.current=c,x&&c.observe(x),y.current.forEach(I=>{c.observe(I)}),()=>{c.disconnect(),s.current=null}},[x]);const T=_(c=>(R.current.add(c),()=>{R.current.delete(c)})),f=_(c=>(y.current.add(c),s.current?.observe(c),()=>{y.current.delete(c),s.current?.unobserve(c)})),g={orientation:P,tabActivationDirection:m},V={"aria-orientation":P==="vertical"?"vertical":void 0,role:"tablist"},L=a.useMemo(()=>({activateOnFocus:C,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:f,tabsListElement:x}),[C,T,f,x]);return n.jsx(De.Provider,{value:L,children:n.jsx(bt,{render:u,className:i,style:A,state:g,refs:[r,l],props:[V,E],stateAttributesMapping:ie,highlightedIndex:O,enableHomeAndEndKeys:!0,loopFocus:j,orientation:P,onHighlightedIndexChange:D,onMapChange:w,disabledIndices:ue})})});function mt({className:t,orientation:o="horizontal",...r}){return n.jsx(it,{"data-slot":"tabs","data-orientation":o,className:re("group/tabs flex gap-2 data-horizontal:flex-col",t),...r})}const vt=He("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function xt({className:t,variant:o="default",...r}){return n.jsx(ht,{"data-slot":"tabs-list","data-variant":o,className:re(vt({variant:o}),t),...r})}function te({className:t,...o}){return n.jsx(ct,{"data-slot":"tabs-trigger",className:re("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",t),...o})}function ne({className:t,...o}){return n.jsx(dt,{"data-slot":"tabs-content",className:re("flex-1 text-sm outline-none",t),...o})}function Rt(t){return`<script src="${location.origin}/snag.js" ${Be("site")}="${t}" defer><\/script>`}function Y({code:t,label:o}){const[r,C]=a.useState(!1);return n.jsxs("div",{className:"relative rounded-md border border-border bg-background px-3 py-2.5 pr-11 font-mono text-[12.5px] leading-relaxed",children:[n.jsx("code",{className:"whitespace-pre-wrap break-all",children:t}),n.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"absolute right-1.5 top-1.5","aria-label":r?"Copied":o,onClick:()=>{navigator.clipboard?.writeText(t),C(!0),setTimeout(()=>C(!1),1500)},children:r?n.jsx(ot,{}):n.jsx(rt,{})})]})}const se="npm install snagset";function ae({children:t}){return n.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:t})}function wt({uid:t}){const o=location.origin,r=`host="${o}" site="${t}"`;return n.jsxs(mt,{defaultValue:"html",className:"gap-3",children:[n.jsxs(xt,{className:"w-full",children:[n.jsx(te,{value:"html",children:"HTML"}),n.jsx(te,{value:"next",children:"Next.js"}),n.jsx(te,{value:"react",children:"React"}),n.jsx(te,{value:"vue",children:"Vue"}),n.jsx(te,{value:"js",children:"JS"})]}),n.jsxs(ne,{value:"html",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:Rt(t),label:"Copy the tag"}),n.jsxs(ae,{children:["Paste it before ",n.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed. On WordPress, Webflow, Framer or Squarespace, put it in the site's footer or custom code setting."]})]}),n.jsxs(ne,{value:"next",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:se,label:"Copy the install command"}),n.jsx(Y,{code:`// app/layout.tsx
|
|
1
|
+
import{r as a,i as je,e as Z,f as _,k as oe,j as n,aW as Ne,aw as Le,ay as Oe,aT as ue,E as Ve,bh as ze,h as re,o as He,B as Ke,bi as Be}from"./index-CUBD0DcL.js";import{k as _e,c as Pe,C as pe,D as ge,d as Fe,u as we,m as $e,o as be,a as We,n as Ye,g as he}from"./createBaseUIEventDetails-BlUeVOHL.js";import{C as ke,u as Ue,a as Je}from"./CompositeList-CDfO6SCy.js";import{i as qe}from"./isElementDisabled-CwHw_lZC.js";import{a as Ge,u as Qe,t as Xe,i as Ze,s as me,k as ve,h as le,e as ce,H as xe,E as Re,C as et,l as Ce,g as tt,f as nt,A as ye,m as Ie,n as Te,o as Ee,M as at}from"./inertValue-BxLh7N1J.js";import{u as st}from"./useCompositeItem-BZX9S0sx.js";import{C as ot}from"./check-26YOtWVN.js";import{C as rt}from"./copy-DqhiNOHN.js";const Se=a.createContext(void 0);function fe(){const t=a.useContext(Se);if(t===void 0)throw new Error(je(64));return t}const ie={tabActivationDirection:t=>({"data-activation-direction":t})},it=a.forwardRef(function(o,r){const{className:C,defaultValue:i=0,onValueChange:j,orientation:u="horizontal",render:A,value:T,style:P,...w}=o,m=o.defaultValue!==void 0,O=a.useRef([]),[D,x]=a.useState(()=>new Map),[l,R]=_e({controlled:T,default:i,name:"Tabs",state:"value"}),y=T!==void 0,[s,E]=a.useState(()=>new Map),f=a.useRef(void 0),g=a.useCallback(p=>de(s,p),[s]),[V,L]=a.useState(()=>({previousValue:l,tabActivationDirection:"none"})),{previousValue:c,tabActivationDirection:I}=V;let e=I,d=!1;c!==l&&(e=Me(c,l,u,s),d=c!=null&&l!=null&&g(l)==null);const b=d?c:l,k=c!==b||I!==e;Z(()=>{k&&L({previousValue:b,tabActivationDirection:e})},[b,k,e]);const S=_((p,M)=>{const W=Me(l,p,u,s);M.activationDirection=W,j?.(p,M),!M.isCanceled&&R(p)}),H=_((p,M)=>{j?.(p,Pe(M,void 0,void 0,{activationDirection:"none"}))}),F=_((p,M)=>(x(W=>{const G=new Map(W);return G.set(p,M),G}),()=>{x(W=>{if(W.get(p)!==M)return W;const G=new Map(W);return G.delete(p),G})})),U=a.useCallback(p=>D.get(p),[D]),N=a.useCallback(p=>{for(const M of s.values())if(p===M.value)return M.id},[s]),h=a.useMemo(()=>({getTabElementBySelectedValue:g,getTabIdByPanelValue:N,getTabPanelIdByValue:U,onValueChange:S,orientation:u,registerMountedTabPanel:F,setTabMap:E,tabActivationDirection:e,value:l}),[g,N,U,S,u,F,E,e,l]),z=a.useMemo(()=>{for(const p of s.values())if(p.value===l)return p},[s,l]),$=a.useMemo(()=>{for(const p of s.values())if(!p.disabled)return p.value},[s]),K=a.useRef(!m),J=a.useRef(i),q=a.useRef(m),v=a.useRef(!1);Z(()=>{if(y)return;function p(X,ee){R(X),L({previousValue:X,tabActivationDirection:"none"}),H(X,ee),K.current=!1}if(s.size===0){v.current&&l!==null&&!f.current?.isConnected&&p(null,ge);return}v.current=!0,f.current=s.keys().next().value;const M=z?.disabled,W=z==null&&l!==null;if(!M&&l===J.current&&(q.current=!1),q.current&&M&&l===J.current)return;const G=K.current;if(M||W){const X=$??null;if(l===X){K.current=!1;return}let ee=ge;G?ee=pe:M&&(ee=Fe),p(X,ee);return}G&&z!=null&&(H(l,pe),K.current=!1)},[$,y,H,z,R,s,l]);const Q=oe("div",o,{state:{orientation:u,tabActivationDirection:e},ref:r,props:w,stateAttributesMapping:ie});return n.jsx(Se.Provider,{value:h,children:n.jsx(ke,{elementsRef:O,children:Q})})});function de(t,o){for(const[r,C]of t.entries())if(o===C.value)return r;return null}function Me(t,o,r,C){if(t==null||o==null)return"none";const[i,j,u]=r==="horizontal"?["left","left","right"]:["top","up","down"],A=de(C,t),T=de(C,o);if(A==null||T==null)return A!==T&&(typeof t=="number"||typeof t=="string")&&typeof t==typeof o?o>t?u:j:"none";const P=A.getBoundingClientRect()[i],w=T.getBoundingClientRect()[i];return w<P?j:w>P?u:"none"}const Ae="data-composite-item-active",De=a.createContext(void 0);function lt(){const t=a.useContext(De);if(t===void 0)throw new Error(je(65));return t}const ct=a.forwardRef(function(o,r){const{className:C,disabled:i=!1,render:j,value:u,id:A,nativeButton:T=!0,style:P,...w}=o,{value:m,getTabPanelIdByValue:O,onValueChange:D,orientation:x,tabActivationDirection:l}=fe(),{activateOnFocus:R,registerTabResizeObserverElement:y,tabsListElement:s}=lt(),{highlightedIndex:E,onHighlightedIndexChange:f}=Ne(),g=we(A),V=a.useMemo(()=>({disabled:i,id:g,value:u}),[i,g,u]),{compositeProps:L,compositeRef:c,index:I}=st({metadata:V}),e=u===m,d=a.useRef(!1),b=a.useRef(null),k=_(v=>{b.current?.(),b.current=v?y(v):null});Z(()=>{if(d.current){d.current=!1;return}if(!(e&&I>-1&&E!==I))return;const v=s;if(v!=null){const B=$e(be(v));if(B&&We(v,B))return}i||f(I)},[e,I,E,f,i,s]);const{getButtonProps:S,buttonRef:H}=Le({disabled:i,native:T,focusableWhenDisabled:!0}),F=O(u),U=a.useRef(!1),N=a.useRef(!1);function h(v){D(u,Pe(Ye,v.nativeEvent,void 0,{activationDirection:"none"}))}function z(v){e||i||h(v)}function $(v){e||i||R&&(!U.current||N.current)&&h(v)}function K(v){if(e||i)return;U.current=!0,N.current=v.button===0;const B=be(v.currentTarget);function Q(){U.current=!1,N.current=!1,B.removeEventListener("pointerup",Q),B.removeEventListener("pointercancel",Q)}B.addEventListener("pointerup",Q),B.addEventListener("pointercancel",Q)}return oe("button",o,{state:{disabled:i,active:e,orientation:x,tabActivationDirection:l},ref:[r,H,c,k],props:[L,{role:"tab","aria-controls":F,"aria-selected":e,id:g,onClick:z,onFocus:$,onPointerDown:K,[Ae]:e?"":void 0,onKeyDownCapture(){d.current=!0}},w,S],stateAttributesMapping:ie})}),ut={...ie,...Xe},dt=a.forwardRef(function(o,r){const{className:C,value:i,render:j,keepMounted:u=!1,style:A,...T}=o,{value:P,getTabIdByPanelValue:w,orientation:m,tabActivationDirection:O,registerMountedTabPanel:D}=fe(),x=we(),{ref:l,index:R}=Ue(),y=i===P,{mounted:s,transitionStatus:E,setMounted:f}=Ge(y),g=!s,V=w(i),L={hidden:g,orientation:m,tabActivationDirection:O,transitionStatus:E},c=a.useRef(null),I=oe("div",o,{state:L,ref:[r,l,c],props:[{"aria-labelledby":V,hidden:g,id:x,role:"tabpanel",tabIndex:y?0:-1,inert:Ze(!y),"data-index":R},T],stateAttributesMapping:ut});return Qe({open:y,ref:c,onComplete(){y||f(!1)}}),Z(()=>{if(!(x==null||g&&!u))return D(i,x)},[g,u,i,x,D]),u||s?I:null}),ft=[];function pt(t){const{loopFocus:o=!0,orientation:r="both",grid:C,onLoop:i,direction:j,highlightedIndex:u,onHighlightedIndexChange:A,rootRef:T,enableHomeAndEndKeys:P=!1,stopEventPropagation:w,disabledIndices:m,modifierKeys:O=ft}=t,[D,x]=a.useState(0),l=C!=null,R=a.useRef(null),y=Oe(R,T),s=a.useRef([]),E=a.useRef(!1),f=u??D,g=_((e,d=!1)=>{if((A??x)(e),d){const b=s.current[e];me(R.current,b,j,r)}}),V=_(e=>{if(e.size===0||E.current)return;E.current=!0;const d=Array.from(e.keys()),b=d.find(S=>S?.hasAttribute(Ae))??null,k=b?e.get(b)?.index??-1:-1;if(k!==-1)g(k);else if(ve(d,f,m)){const S=le(d,{disabledIndices:m});ce(d,S)||g(S)}me(R.current,b,j,r)});Z(()=>{if(m==null||u!=null||!E.current)return;const e=s.current;if(ve(e,f,m)){const d=le(e,{disabledIndices:m});ce(e,d)||g(d)}},[m,u,f,s,g]);const L=_((e,d,b)=>i?i(e,d,b,s):b),c=_(e=>{const d=e.key===xe||e.key===Re;if(!et.has(e.key)||!P&&d||gt(e,O)||!R.current)return;const k=j==="rtl",S=k?Te:Ee,H=k?Ee:Te,F=r==="vertical"?ye:S,U=r==="vertical"?Ie:H,N=he(e.nativeEvent);if(N!=null&&Ce(N)&&!qe(N)){const q=N.selectionStart,v=N.selectionEnd,B=N.value;if(q==null||e.shiftKey||q!==v||e.key!==U&&q<B.length||e.key!==F&&q>0)return}let h=f;const z=tt(s,m),$=nt(s,m);C!=null&&(h=C({disabledIndices:m,elementsRef:s,event:e,highlightedIndex:f,loopFocus:o,maxIndex:$,minIndex:z,onLoop:L,orientation:r,rtl:k}));const K=r!=="vertical"&&e.key===S||r!=="horizontal"&&e.key===ye,J=r!=="vertical"&&e.key===H||r!=="horizontal"&&e.key===Ie;P&&(e.key===xe?h=z:e.key===Re&&(h=$)),h===f&&(K||J)&&(o&&h===$&&K?(h=z,i&&(h=i(e,f,h,s))):o&&h===z&&J?(h=$,i&&(h=i(e,f,h,s))):h=le(s.current,{startingIndex:h,decrement:J,disabledIndices:m})),h!==f&&!ce(s.current,h)&&(w&&e.stopPropagation(),(l||d||K||J)&&e.preventDefault(),g(h,!0),queueMicrotask(()=>{s.current[h]?.focus()}))});return{props:{ref:y,onFocus(e){const d=R.current,b=he(e.nativeEvent);!d||b==null||!Ce(b)||b.setSelectionRange(0,b.value.length)},onKeyDown:c},highlightedIndex:f,onHighlightedIndexChange:g,elementsRef:s,onMapChange:V,relayKeyboardEvent:c}}function gt(t,o){for(const r of at)if(!o.includes(r)&&t.getModifierState(r))return!0;return!1}function bt(t){const{render:o,className:r,style:C,refs:i=ue,props:j=ue,state:u=Ve,stateAttributesMapping:A,highlightedIndex:T,onHighlightedIndexChange:P,orientation:w,grid:m,loopFocus:O,onLoop:D,enableHomeAndEndKeys:x,onMapChange:l,stopEventPropagation:R=!0,rootRef:y,disabledIndices:s,modifierKeys:E,highlightItemOnHover:f=!1,tag:g="div",...V}=t,L=Je(),{props:c,highlightedIndex:I,onHighlightedIndexChange:e,elementsRef:d,onMapChange:b,relayKeyboardEvent:k}=pt({grid:m,loopFocus:O,onLoop:D,orientation:w,highlightedIndex:T,onHighlightedIndexChange:P,rootRef:y,stopEventPropagation:R,enableHomeAndEndKeys:x,direction:L,disabledIndices:s,modifierKeys:E}),S=oe(g,t,{state:u,ref:i,props:[c,...j,V],stateAttributesMapping:A}),H=a.useMemo(()=>({highlightedIndex:I,onHighlightedIndexChange:e,highlightItemOnHover:f,relayKeyboardEvent:k}),[I,e,f,k]);return n.jsx(ze.Provider,{value:H,children:n.jsx(ke,{elementsRef:d,onMapChange:F=>{l?.(F),b(F)},children:S})})}const ht=a.forwardRef(function(o,r){const{activateOnFocus:C=!1,className:i,loopFocus:j=!0,render:u,style:A,...T}=o,{orientation:P,setTabMap:w,tabActivationDirection:m}=fe(),[O,D]=a.useState(0),[x,l]=a.useState(null),R=a.useRef(new Set),y=a.useRef(new Set),s=a.useRef(null);Z(()=>{if(typeof ResizeObserver>"u")return;const c=new ResizeObserver(()=>{R.current.forEach(I=>{I()})});return s.current=c,x&&c.observe(x),y.current.forEach(I=>{c.observe(I)}),()=>{c.disconnect(),s.current=null}},[x]);const E=_(c=>(R.current.add(c),()=>{R.current.delete(c)})),f=_(c=>(y.current.add(c),s.current?.observe(c),()=>{y.current.delete(c),s.current?.unobserve(c)})),g={orientation:P,tabActivationDirection:m},V={"aria-orientation":P==="vertical"?"vertical":void 0,role:"tablist"},L=a.useMemo(()=>({activateOnFocus:C,registerIndicatorUpdateListener:E,registerTabResizeObserverElement:f,tabsListElement:x}),[C,E,f,x]);return n.jsx(De.Provider,{value:L,children:n.jsx(bt,{render:u,className:i,style:A,state:g,refs:[r,l],props:[V,T],stateAttributesMapping:ie,highlightedIndex:O,enableHomeAndEndKeys:!0,loopFocus:j,orientation:P,onHighlightedIndexChange:D,onMapChange:w,disabledIndices:ue})})});function mt({className:t,orientation:o="horizontal",...r}){return n.jsx(it,{"data-slot":"tabs","data-orientation":o,className:re("group/tabs flex gap-2 data-horizontal:flex-col",t),...r})}const vt=He("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function xt({className:t,variant:o="default",...r}){return n.jsx(ht,{"data-slot":"tabs-list","data-variant":o,className:re(vt({variant:o}),t),...r})}function te({className:t,...o}){return n.jsx(ct,{"data-slot":"tabs-trigger",className:re("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground","after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",t),...o})}function ne({className:t,...o}){return n.jsx(dt,{"data-slot":"tabs-content",className:re("flex-1 text-sm outline-none",t),...o})}function Rt(t){return`<script src="${location.origin}/snag.js" ${Be("site")}="${t}" defer><\/script>`}function Y({code:t,label:o}){const[r,C]=a.useState(!1);return n.jsxs("div",{className:"relative rounded-md border border-border bg-background px-3 py-2.5 pr-11 font-mono text-[12.5px] leading-relaxed",children:[n.jsx("code",{className:"whitespace-pre-wrap break-all",children:t}),n.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"absolute right-1.5 top-1.5","aria-label":r?"Copied":o,onClick:()=>{navigator.clipboard?.writeText(t),C(!0),setTimeout(()=>C(!1),1500)},children:r?n.jsx(ot,{}):n.jsx(rt,{})})]})}const se="npm install snagset";function ae({children:t}){return n.jsx("p",{className:"m-0 text-[12.5px] text-muted-foreground",children:t})}function wt({uid:t}){const o=location.origin,r=`host="${o}" site="${t}"`;return n.jsxs(mt,{defaultValue:"html",className:"gap-3",children:[n.jsxs(xt,{className:"w-full",children:[n.jsx(te,{value:"html",children:"HTML"}),n.jsx(te,{value:"next",children:"Next.js"}),n.jsx(te,{value:"react",children:"React"}),n.jsx(te,{value:"vue",children:"Vue"}),n.jsx(te,{value:"js",children:"JS"})]}),n.jsxs(ne,{value:"html",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:Rt(t),label:"Copy the tag"}),n.jsxs(ae,{children:["Paste it before ",n.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed. On WordPress, Webflow, Framer or Squarespace, put it in the site's footer or custom code setting."]})]}),n.jsxs(ne,{value:"next",className:"flex flex-col gap-2",children:[n.jsx(Y,{code:se,label:"Copy the install command"}),n.jsx(Y,{code:`// app/layout.tsx
|
|
2
2
|
import { Snagset } from "snagset/next";
|
|
3
3
|
|
|
4
4
|
<body>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as U,r as f,ah as y,v,ai as j,ad as S,j as e,ac as k,a7 as w,B as x,F as A,H as M}from"./index-CUBD0DcL.js";import{u as L}from"./useQuery-CGx36E5q.js";import{i as B,j as K,l as R,k as I,m as P,n as E}from"./dialog-CjX41K4h.js";import{L as C,I as N}from"./label-BoGrNcZ0.js";import{C as z}from"./ConfirmDialog-B5-FUf01.js";import{u as _}from"./me-DeblO6Os.js";function Y({owner:t}){const a=L(A.instance()),l=U(),s=()=>l.invalidateQueries({queryKey:A.instance().queryKey}),[g,m]=f.useState(!1),[b,h]=f.useState(!1),[p,u]=f.useState(null),d=y({mutationFn:v.disconnectStorage,onSuccess:()=>void s(),onError:c=>j.error(S(c))}),n=y({mutationFn:v.disconnectMail,onSuccess:()=>void s(),onError:c=>j.error(S(c))}),i=y({mutationFn:v.testMail,onSuccess:c=>j.success(`Sent to ${c.to}`),onError:c=>j.error(S(c))}),r=a.data?.storage,o=a.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(k,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!a.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:a.isError?"Could not read it.":"Reading…"}),r&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{tone:r.connected?"ok":r.unreadable?"bad":"off",text:r.connected?`Connected · ${r.bucket} at ${(r.endpoint??"").replace(/^https?:\/\//,"")}${r.connectedAt?` · since ${w(r.connectedAt)}`:""}`:r.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),e.jsx(O,{}),r.source==="env"?e.jsx(F,{what:"SNAGSET_STORAGE_S3_*"}):t?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{variant:"outline",size:"sm",onClick:()=>m(!0),children:r.connected||r.unreadable?"Replace…":"Connect a bucket…"}),(r.connected||r.unreadable)&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(k,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(D,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${w(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx(F,{what:"SNAGSET_MAIL_URL"}):t?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(x,{variant:"outline",size:"sm",onClick:()=>h(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(x,{variant:"outline",size:"sm",loading:i.isPending,onClick:()=>i.mutate(),children:i.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&t===!1,null)]})}),e.jsx(q,{open:g,onOpenChange:m,onDone:()=>void s()}),e.jsx(G,{open:b,onOpenChange:h,onDone:()=>void s()}),e.jsx(z,{open:p!==null,onOpenChange:c=>!c&&u(null),title:p==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:p==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:d.isPending||n.isPending,onConfirm:async()=>{p==="storage"?await d.mutateAsync():await n.mutateAsync(),u(null)}})]})}function T(){const{storage:t}=_().limits;return t.limit===null?null:`${$(t.used)} of ${$(t.limit)} used across the studio's sites.`}function O(){const t=T();return t===null?null:e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:t})}function Z(){const t=T();return t===null?null:e.jsx(k,{title:"Storage",description:"Screenshots and files, against the studio's plan.",children:e.jsx("p",{className:"m-0 text-[13px]",children:t})})}function D({tone:t,text:a}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${t==="ok"?"bg-ok":t==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:a})]})}function F({what:t}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:t}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function q({open:t,onOpenChange:a,onDone:l}){const[s,g]=f.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[m,b]=f.useState(""),h=y({mutationFn:v.connectStorage}),p=n=>i=>g({...s,[n]:i.target.value}),u=async n=>{n.preventDefault(),b("");try{await h.mutateAsync({endpoint:s.endpoint.trim(),bucket:s.bucket.trim(),accessKeyId:s.accessKeyId.trim(),secretAccessKey:s.secretAccessKey,...s.region.trim()?{region:s.region.trim()}:{},...s.publicBaseUrl.trim()?{publicBaseUrl:s.publicBaseUrl.trim()}:{}}),g({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),a(!1),l(),j.success("Bucket connected — screenshots are on")}catch(i){b(i instanceof M?i.message:"Could not reach the server.")}},d=(n,i,r,o="text",c)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`st-${n}`,children:i}),e.jsx(N,{id:`st-${n}`,type:o,placeholder:r,value:s[n],onChange:p(n),autoComplete:"off"}),c&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c})]});return e.jsx(B,{open:t,onOpenChange:a,children:e.jsx(K,{children:e.jsxs("form",{onSubmit:n=>void u(n),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(P,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),m&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:m}),d("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),d("bucket","Bucket","snagset"),d("region","Region","auto","text","Leave empty for providers that do not use one."),d("accessKeyId","Access key ID",""),d("secretAccessKey","Secret access key","","password"),d("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(E,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:h.isPending,children:h.isPending?"Probing…":"Connect"})]})]})})})}function G({open:t,onOpenChange:a,onDone:l}){const[s,g]=f.useState(""),[m,b]=f.useState(""),[h,p]=f.useState(""),u=y({mutationFn:v.connectMail}),d=async n=>{n.preventDefault(),p("");try{await u.mutateAsync({url:s.trim(),from:m.trim()}),g(""),b(""),a(!1),l(),j.success("Transport connected — send a test email to be sure")}catch(i){p(i instanceof M?i.message:"Could not reach the server.")}};return e.jsx(B,{open:t,onOpenChange:a,children:e.jsx(K,{children:e.jsxs("form",{onSubmit:n=>void d(n),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(R,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(P,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),h&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:h}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mail-url",children:"Transport"}),e.jsx(N,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:s,onChange:n=>g(n.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mail-from",children:"From"}),e.jsx(N,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:m,onChange:n=>b(n.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(E,{children:[e.jsx(x,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(x,{type:"submit",loading:u.isPending,disabled:!s.trim()||!m.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function $(t){const a=["B","KB","MB","GB","TB"];let l=t,s=0;for(;l>=1024&&s<a.length-1;)l/=1024,s+=1;return`${s===0?l:l.toFixed(l>=10?0:1)} ${a[s]}`}export{Y as I,Z as S,$ as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as Q,r as p,ah as P,j as e,ac as H,a5 as J,a7 as K,B as b,ai as A,ad as D,F as M,v as R,am as z,H as G}from"./index-CUBD0DcL.js";import{P as E}from"./Picker-BvdKGeU8.js";import{u as W}from"./useQuery-CGx36E5q.js";import{B as O}from"./badge-Cwf-GPv8.js";import{i as F,j as _,l as B,k as $,m as I,n as q}from"./dialog-CjX41K4h.js";import{L as C,I as U}from"./label-BoGrNcZ0.js";import{S as Y}from"./switch-DmO3bJxP.js";import{C as V}from"./ConfirmDialog-B5-FUf01.js";import{C as w}from"./CopyButton-CDVY09FZ.js";function ce({owner:n,instanceOwner:i,operator:g,sites:v,mine:h=!1}){const o=Q(),a=W(M.mcpTokens()),[x,u]=p.useState(!1),[l,m]=p.useState(null),[c,j]=p.useState(null),k=P({mutationFn:t=>R.revokeMcpToken(t),onSuccess:()=>{j(null),o.invalidateQueries({queryKey:["mcp-tokens"]})},onError:t=>A.error(D(t))}),f=a.data?.data??[],N=f.filter(t=>!t.revokedAt),d=a.data?.http??null,y=P({mutationFn:t=>R.setMcpHttp(t),onSuccess:(t,s)=>{o.setQueryData(M.instance().queryKey,t),o.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(s?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:t=>A.error(D(t))}),S=t=>{const s=new Set(t),r=s.has("comments:write")||s.has("threads:write");return!r&&!s.has("context:read")?"Read-only":r?`Writes: ${[s.has("comments:write")?"reply":"",s.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(H,{title:h?"Your agent tokens":"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[a.isPending&&e.jsx(J,{rows:2}),d&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[d.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:d.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:d.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),d.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":i?"":g?" Only an owner can switch it.":" Only whoever runs this server can switch it."]})]}),e.jsx(Y,{id:"mcp-http-on","aria-label":"Remote transport",checked:d.enabled,disabled:!i||d.source==="env"||y.isPending,onCheckedChange:t=>y.mutate(t)})]}),a.isSuccess&&N.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{variant:"outline",children:f.length>0?"No active tokens":"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:h?"You have no agent tokens yet.":"No agent can read this studio yet."})]}),f.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:f.map(t=>e.jsxs("li",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px] ${t.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[t.prefix,"…"]}),e.jsx(O,{variant:"outline",className:t.revokedAt?"":"border-ok text-ok",children:t.revokedAt?"Revoked":S(t.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[t.site?t.site.name:"All sites"," · ",t.lastUsedAt?`last used ${K(t.lastUsedAt)}`:"never used",t.expiresAt&&!t.revokedAt?` · expires ${new Date(t.expiresAt).toLocaleDateString()}`:"",t.createdBy?` · by ${t.createdBy}`:""]}),t.canRevoke&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>j(t),children:"Revoke"})})]},t.id))}),n&&e.jsx("div",{children:e.jsx(b,{variant:"outline",size:"sm",onClick:()=>u(!0),children:"New token…"})}),e.jsx(X,{open:x,onOpenChange:u,sites:v,http:a.data?.http??null,onDone:t=>{o.invalidateQueries({queryKey:["mcp-tokens"]}),m(t)}}),e.jsx(Z,{state:l,http:a.data?.http??null,onClose:()=>m(null)}),e.jsx(V,{open:c!==null,onOpenChange:t=>!t&&j(null),title:`Revoke “${c?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:k.isPending,onConfirm:async()=>{c&&await k.mutateAsync(c.id)}})]})}function X({open:n,onOpenChange:i,sites:g,http:v,onDone:h}){const[o,a]=p.useState(""),[x,u]=p.useState(""),[l,m]=p.useState(["threads:read","source:map"]),[c,j]=p.useState(""),[k,f]=p.useState(!1),[N,d]=p.useState(""),y=P({mutationFn:()=>R.mintMcpToken({name:o.trim(),...x?{site:x}:{},scopes:l,...c?{expiresInDays:Number(c)}:{},...k?{allowRemoteWrites:!0}:{}})}),S=(s,r)=>m(T=>r?[...new Set([...T,s])]:T.filter(L=>L!==s)),t=async s=>{s.preventDefault(),d("");try{const r=await y.mutateAsync();a(""),u(""),m(["threads:read","source:map"]),j(""),f(!1),i(!1),h(r)}catch(r){d(r instanceof G?r.message:"Could not reach the server.")}};return e.jsx(F,{open:n,onOpenChange:i,children:e.jsx(_,{children:e.jsxs("form",{onSubmit:s=>void t(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(B,{children:[e.jsx($,{children:"New agent token"}),e.jsx(I,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),N&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:N}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(U,{id:"mcp-name",placeholder:"Claude Code",value:o,onChange:s=>a(s.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsx(E,{id:"mcp-site",value:x,onChange:u,options:[{value:"",label:"All sites"},...g.map(s=>({value:s.uid,label:s.name}))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),z.map(s=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:l.includes(s.scope),onChange:r=>S(s.scope,r.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:s.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:s.hint})]})]},s.scope))]}),v?.enabled&&(l.includes("comments:write")||l.includes("threads:write"))&&e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:k,onChange:s=>f(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsx(E,{id:"mcp-expires",value:c,onChange:j,options:[{value:"",label:"Never"},{value:"30",label:"In 30 days"},{value:"90",label:"In 90 days"},{value:"365",label:"In a year"}]})]}),e.jsxs(q,{children:[e.jsx(b,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),e.jsx(b,{type:"submit",loading:y.isPending,disabled:!o.trim()||l.length===0,children:y.isPending?"Minting…":"Create token"})]})]})})})}function Z({state:n,http:i,onClose:g}){const v=typeof location<"u"?location.origin:"",h={SNAGSET_MCP_TOKEN:n?.secret??"",SNAGSET_MCP_HOST:v,...n?.token.site?{SNAGSET_MCP_PROJECT:n.token.site.uid}:{}},o=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:h}}},null,2),a=["claude mcp add snagset",...Object.entries(h).map(([m,c])=>`-e ${m}=${c}`),"--","npx -y @snagset/mcp"].join(" "),x=`Bearer ${n?.secret??""}`,u=["claude mcp add","--transport http","snagset",i?.url??"",`--header "Authorization: ${x}"`].join(" "),l=JSON.stringify({mcpServers:{snagset:{type:"http",url:i?.url??"",headers:{Authorization:x}}}},null,2);return e.jsx(F,{open:n!==null,onOpenChange:m=>!m&&g(),children:e.jsxs(_,{className:"sm:max-w-xl",children:[e.jsxs(B,{children:[e.jsxs($,{children:["Token for “",n?.token.name??"","”"]}),e.jsx(I,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),n&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:n.secret}),e.jsx(w,{text:n.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(w,{text:a,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:a})]}),i?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(w,{text:l,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 whitespace-pre-wrap break-all rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:u}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:l}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(w,{text:o,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:o}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(q,{children:e.jsx(b,{type:"button",onClick:g,children:"Done"})})]})})}export{ce as M};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as Xt,
|
|
1
|
+
import{c as Xt,av as Lt,e as xe,l as Gt,r as s,i as vt,j as h,aT as At,f as He,m as ht,E as Kt,ay as Jt,aw as Nt,k as Te,g as ft,h as Fe}from"./index-CUBD0DcL.js";import{C as Ot}from"./chevron-down-OinKSKsq.js";import{C as Zt}from"./check-26YOtWVN.js";import{E as Qt,a2 as en,P as tn,R as nn,a3 as c,l as Ht,g as on,F as sn,v as rn,r as ln,m as nt,a4 as an,$ as cn,t as un,J as dn,K as fn,L as pn,y as gn,a as mn,I as hn,q as xn,a5 as bn}from"./useScrollLock-DV4rQnvf.js";import{i as Sn}from"./isElementDisabled-CwHw_lZC.js";import{w as vn,e as yn,h as Ft,A as Dt,k as Ct,l as Rn,x as wn,s as In,c as Ie,n as st,j as Tn,f as Mn,o as xt,a as pt,z as En,B as An,r as gt}from"./createBaseUIEventDetails-BlUeVOHL.js";import{a as yt,u as it,i as Cn,d as Pn,t as Rt,C as Vn}from"./inertValue-BxLh7N1J.js";import{s as bt}from"./serializeValue-B8e3iXO-.js";import{u as jn}from"./useValueChanged-BcwdNwDJ.js";import{d as Ln,h as Nn,e as On,f as Hn,i as Fn,c as Dn,u as kn,a as Un,b as Bn,p as _n,r as zn,g as Wn}from"./getPseudoElementBounds-087ogDm1.js";import{C as Yn,a as $n,u as qn}from"./CompositeList-CDfO6SCy.js";/**
|
|
2
2
|
* @license lucide-react v1.39.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Xn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gn=Xt("chevron-up",Xn);function Kn(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,u=vn(),p=Zt()!=null,r=Nt(()=>new en({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new tn,floatingId:u,syncOnly:!1,nested:p})).current;return xe(()=>{const d={open:t,floatingId:u};o.reference!==void 0&&(d.referenceElement=o.reference,d.domReferenceElement=Gt(o.reference)?o.reference:null),o.floating!==void 0&&(d.floatingElement=o.floating),r.update(d)},[t,u,o.reference,o.floating,r]),r.context.onOpenChange=n,r.context.nested=p,r}function Jn(e){const[t,n]=s.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}const Qn=s.createContext(void 0),Zn={disableStyleElements:!1};function eo(){return s.useContext(Qn)??Zn}function to(e){const t=s.useRef(!0);t.current&&(t.current=!1,e())}const kt=s.createContext(null);function be(){const e=s.useContext(kt);if(e===null)throw new Error(vt(60));return e}const no=(e,t)=>Object.is(e,t);function We(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:We(o,t,n))}function oo(e,t,n){return e.filter(o=>!We(t,o,n))}function Ut(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function so(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Ut(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Bt(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return bt(e)}function ze(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?bt(e.value):bt(e)}function _t(e,t,n){function o(){return Bt(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const u=t,p=Ut(u)?u.flatMap(r=>r.items):u;if(e==null||typeof e!="object"){const r=p.find(d=>d.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=p.find(d=>d&&d.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function ro(e,t,n){return e.reduce((o,u,p)=>(p>0&&o.push(", "),o.push(h.jsx(s.Fragment,{children:_t(u,t,n)},p)),o),[])}const a={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ze(t,o)!==""},hasNullItemLabel:(e,t)=>t?so(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(u=>We(t,u,n)):We(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function lo(e,t,n=(o,u)=>o===u){return e.length===t.length&&e.every((o,u)=>n(o,t[u]))}function $e(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const ge=1;function wt(e,t){return Math.max(0,e-t)}function rt(e,t){if(t<=0)return 0;const n=$e(e,0,t),o=n,u=t-n,p=o<=ge,r=u<=ge;return p&&r?o<=u?0:t:p?0:r?t:n}function io(e){const{id:t,value:n,defaultValue:o=null,onValueChange:u,open:p,defaultOpen:r=!1,onOpenChange:d,name:g,form:i,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:I=!1,modal:C=!0,actionsRef:U,inputRef:S,onOpenChangeComplete:Y,items:L,multiple:T=!1,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B=no,highlightItemOnHover:N=!0,children:q}=e,{clearErrors:O}=yn(),{setDirty:ue,setTouched:$,setFocused:le,validityData:K,setFilled:H,name:V,disabled:J,validation:R,validationMode:ne}=Ft(),_=Dt({id:t}),P=J||b,l=V??g,[m,Q]=Ct({controlled:n,default:T?o??At:o,name:"Select",state:"value"}),[F,oe]=Ct({controlled:p,default:r,name:"Select",state:"open"}),f=s.useRef([]),v=s.useRef([]),D=s.useRef(null),ee=s.useRef(null),Se=s.useRef(0),E=s.useRef(null),X=s.useRef([]),z=s.useRef(!1),de=s.useRef(null),Z=s.useRef(null),se=s.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=s.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:W}=yt(F),{openMethod:G,triggerProps:ae}=Nn(F),A=Nt(()=>new nn({id:_,labelId:void 0,modal:C,multiple:T,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B,value:m,open:F,mounted:ie,transitionStatus:W,items:L,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Me=c(A,a.activeIndex),ve=c(A,a.selectedIndex),ye=c(A,a.triggerElement),ce=c(A,a.positionerElement),je=Jn(G),Ne=G??je,te=s.useMemo(()=>T?"":ze(m,j),[T,m,j]),at=s.useMemo(()=>T&&Array.isArray(m)?m.map(w=>ze(w,j)):ze(m,j),[T,m,j]),Ge=Ht(ye),Re=He(()=>at);Rn(Ge,_,m,Re,!P,g);const ct=s.useRef(m),Ye=T?Array.isArray(m)&&m.length>0:m!=null&&te!=="";xe(()=>{H(Ye)},[Ye,H]),xe(function(){let k=m,we=!1;if(T){const Le=Array.isArray(m)?m:[];we=Le.length===0,k=Le[Le.length-1]}const Pe=we?-1:ot(X.current,k,B),Ve=Pe===-1?null:Pe;Ve===null&&(Z.current=null),!F&&A.set("selectedIndex",Ve)},[T,F,m,B,A]);function me(w){const k=K.initialValue;return Array.isArray(w)&&Array.isArray(k)?!lo(w,k,(we,Pe)=>We(we,Pe,B)):w!==k}jn(m,()=>{O(l),ue(me(m)),R.change(m)});const De=He((w,k)=>{d?.(w,k),!k.isCanceled&&(oe(w),!w&&(k.reason===wn||k.reason===In)&&($(!0),le(!1),ne==="onBlur"&&R.commit(m)))}),ke=He(()=>{fe(!1),A.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),Y?.(!1)});it({enabled:!U,open:F,ref:D,onComplete(){F||ke()}}),s.useImperativeHandle(U,()=>({unmount:ke}),[ke]);const Ee=He((w,k)=>{u?.(w,k),!k.isCanceled&&Q(w)}),he=He(w=>{const k=wt(w.scrollHeight,w.clientHeight),we=rt(w.scrollTop,k),Pe=we>0,Ve=we<k;A.set("scrollUpArrowVisible",Pe),A.set("scrollDownArrowVisible",Ve)}),Ae=Kn({open:F,onOpenChange:De,elements:{reference:ye,floating:ce}}),Ue=On(Ae,{enabled:!y&&!P,event:"mousedown"}),Be=on(Ae),Ce=Ln(Ae,{enabled:!y&&!P,listRef:f,activeIndex:Me,selectedIndex:ve,disabledIndices:At,onNavigate(w){w===null&&!F||A.set("activeIndex",w)},focusItemOnHover:N}),Oe=Hn(Ae,{enabled:!y&&!P&&(F||!T),listRef:v,activeIndex:Me,selectedIndex:ve,disabledIndices:w=>Sn(f.current[w]),onMatch(w){F?A.set("activeIndex",w):Ee(X.current[w],Ie(st))},onTyping(w){z.current=w}}),Ke=s.useMemo(()=>ht(Oe.reference,Ce.reference,Be.reference,Ue.reference,ae),[Ue.reference,Oe.reference,Ce.reference,Be.reference,ae]),Je=s.useMemo(()=>ht(sn,Oe.floating,Ce.floating,Be.floating),[Oe.floating,Ce.floating,Be.floating]),Qe=Ce.item??Kt;to(()=>{A.update({popupProps:Je,triggerProps:Ke})}),A.useSyncedValues({id:_,modal:C,multiple:T,value:m,open:F,mounted:ie,transitionStatus:W,popupProps:Je,triggerProps:Ke,items:L,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B,openMethod:Ne});const pe=s.useMemo(()=>({store:A,floatingContext:Ae,required:I,disabled:P,readOnly:y,multiple:T,highlightItemOnHover:N,setValue:Ee,setOpen:De,listRef:f,popupRef:D,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:Se,itemProps:Qe,valueRef:E,valuesRef:X,labelsRef:v,typingRef:z,selectionRef:se,firstItemTextRef:de,selectedItemTextRef:Z,validation:R,onOpenChangeComplete:Y,alignItemWithTriggerActiveRef:re,initialValueRef:ct}),[A,Ae,I,P,y,T,N,Ee,De,Qe,R,Y,he]),_e=Jt(S,R.inputRef),qe=T?void 0:l,ut=s.useMemo(()=>!T||!Array.isArray(m)||!l?null:m.map(w=>{const k=ze(w,j);return h.jsx("input",{type:"hidden",form:i,name:l,value:k,disabled:P},k)}),[T,m,i,l,j,P]);return h.jsxs(kt.Provider,{value:pe,children:[q,h.jsx("input",{...R.getValidationProps(P,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(w){if(w.nativeEvent.defaultPrevented||P||y)return;const k=w.currentTarget.value,we=Ie(st,w.nativeEvent);function Pe(){if(T)return;const Ve=k.toLowerCase();let Le=X.current.findIndex(dt=>ze(dt,j).toLowerCase()===Ve||Bt(dt,M).toLowerCase()===Ve);Le===-1&&(Le=X.current.findIndex((dt,$t)=>{const Et=v.current[$t];return Et!=null&&Et.toLowerCase()===Ve}));const Mt=X.current[Le];Mt!=null&&Ee(Mt,we)}A.set("forceMount",!0),queueMicrotask(Pe)}}),id:_&&qe==null?`${_}-hidden-input`:void 0,form:i,name:qe,autoComplete:x,value:te,disabled:P,required:I&&!(T&&Ye),readOnly:y,ref:_e,style:l?rn:ln,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ut]})}function ao(e,t){return e??t}const co=400,uo={...cn,...Mn,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},fo=s.forwardRef(function(t,n){const{render:o,className:u,id:p,disabled:r=!1,nativeButton:d=!0,style:g,...i}=t,{setTouched:x,setFocused:b,validationMode:y,state:I,disabled:C}=Ft(),{labelId:U}=Tn(),{store:S,setOpen:Y,selectionRef:L,validation:T,readOnly:M,required:j,alignItemWithTriggerActiveRef:B,disabled:N}=be(),q=C||N||r,O=c(S,a.open),ue=c(S,a.mounted),$=c(S,a.value),le=c(S,a.triggerProps),K=c(S,a.positionerElement),H=c(S,a.listElement),V=c(S,a.popupSide),J=c(S,a.id),R=c(S,a.labelId),ne=c(S,a.hasSelectedValue),_=ue&&K?V:null,P=p??J,l=ao(U,R);Dt({id:P});const m=Ht(K),Q=s.useRef(null),{getButtonProps:F,buttonRef:oe}=Ot({disabled:q,native:d}),f=S.useStateSetter("triggerElement"),v=nt(),D=nt(),ee=nt();s.useEffect(()=>{if(O)return ee.start(co,()=>{L.current.allowUnselectedMouseUp=!0,L.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};L.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},D.clear()},[O,L,D,ee]);const Se=ht(le,{id:P,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?H?.id??an(K)?.id:void 0,"aria-labelledby":l,"aria-readonly":M||void 0,"aria-required":j||void 0,tabIndex:q?-1:0,onFocus(z){b(!0),O&&B.current&&Y(!1,Ie(st,z.nativeEvent)),v.start(0,()=>{S.set("forceMount",!0)})},onBlur(z){pt(K,z.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&T.commit($))},onMouseDown(z){if(O)return;const de=xt(z.currentTarget);function Z(se){if(!Q.current)return;const re=se.target;pt(Q.current,re)||pt(m.current,re)||Fn(se,Q.current)||Y(!1,Ie(En,se))}D.start(0,()=>{de.addEventListener("mouseup",Z,{once:!0})})}},i,F),E=T.getValidationProps(q,Se);E.role="combobox";const X={...I,open:O,disabled:q,value:$,readOnly:M,popupSide:_,placeholder:!ne};return Te("button",t,{ref:[n,Q,oe,f],state:X,stateAttributesMapping:uo,props:E})}),po={value:()=>null},go=s.forwardRef(function(t,n){const{className:o,render:u,children:p,placeholder:r,style:d,...g}=t,{store:i,valueRef:x}=be(),b=c(i,a.value),y=c(i,a.items),I=c(i,a.itemToStringLabel),C=c(i,a.hasSelectedValue),U=!C&&r!=null&&p==null,S=c(i,a.hasNullItemLabel,U),Y={value:b,placeholder:!C};let L=null;return typeof p=="function"?L=p(b):p!=null?L=p:U&&!S?L=r:Array.isArray(b)?L=ro(b,y,I):L=_t(b,y,I),Te("span",t,{state:Y,ref:[n,x],props:[{children:L},g],stateAttributesMapping:po})}),mo=s.forwardRef(function(t,n){const{render:o,className:u,style:p,...r}=t,{store:d}=be(),i={open:c(d,a.open)};return Te("span",t,{state:i,ref:n,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:un})}),ho=s.forwardRef(function(t,n){const{store:o}=be(),u=c(o,a.mounted),p=c(o,a.forceMount);return u||p?h.jsx(dn,{ref:n,...t}):null}),zt=s.createContext(void 0);function It(){const e=s.useContext(zt);if(!e)throw new Error(vt(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const Wt={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},xo={position:"fixed"},bo=s.forwardRef(function(t,n){const{anchor:o,className:u,render:p,positionMethod:r,side:d,align:g,sideOffset:i,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:I,sticky:C,disableAnchorTracking:U,alignItemWithTrigger:S=!0,collisionAvoidance:Y=fn,style:L,...T}=t,{store:M,listRef:j,labelsRef:B,alignItemWithTriggerActiveRef:N,selectedItemTextRef:q,valuesRef:O,initialValueRef:ue,popupRef:$,setValue:le,floatingContext:K}=be(),H=c(M,a.open),V=c(M,a.mounted),J=c(M,a.modal),R=c(M,a.value),ne=c(M,a.openMethod),_=c(M,a.positionerElement),P=c(M,a.triggerElement),l=c(M,a.isItemEqualToValue),m=c(M,a.transitionStatus),Q=s.useRef(null),F=s.useRef(null),[oe,f]=s.useState(S),v=V&&oe&&ne!=="touch";!V&&oe!==S&&f(S),s.useImperativeHandle(N,()=>v),Dn((v||J)&&H,ne==="touch",_,P);const D=kn({anchor:o,floatingRootContext:K,positionMethod:r,mounted:V,side:d,sideOffset:i,align:g,alignOffset:x,arrowPadding:I,collisionBoundary:b,collisionPadding:y,sticky:C,disableAnchorTracking:U??v,collisionAvoidance:Y,keepMounted:!0}),ee=v?"none":D.side,Se=v?xo:D.positionerStyles,E={open:H,side:ee,align:D.align,anchorHidden:D.anchorHidden};xe(()=>{M.set("popupSide",D.side)},[M,D.side]);const X=M.useStateSetter("positionerElement"),z=Un(t,E,{styles:Se,transitionStatus:m,props:T,refs:[n,X],hidden:!V,inert:!H}),de=s.useRef(0),Z=He(re=>{if(O.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Ie(st);if(ie!==0&&!M.state.multiple&&R!==null&&ot(O.current,R,l)===-1){const G=ue.current,A=G!=null&&ot(O.current,G,l)!==-1?G:null;le(A,fe),A===null&&(M.set("selectedIndex",null),q.current=null)}if(ie!==0&&M.state.multiple&&Array.isArray(R)){const W=R.filter(G=>ot(O.current,G,l)!==-1);W.length!==R.length&&(le(W,fe),W.length===0&&(M.set("selectedIndex",null),q.current=null))}if(H&&v){M.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const W={height:""};lt(_,W),lt($.current,W)}}),se=s.useMemo(()=>({...D,side:ee,alignItemWithTriggerActive:v,setControlledAlignItemWithTrigger:f,scrollUpArrowRef:Q,scrollDownArrowRef:F}),[D,ee,v,f]);return h.jsx(Yn,{elementsRef:j,labelsRef:B,onMapChange:Z,children:h.jsxs(zt.Provider,{value:se,children:[V&&J&&h.jsx(pn,{inert:Cn(!H),cutout:P}),z]})})}),Ze="base-ui-disable-scrollbar",St={className:Ze,getElement(e){return h.jsx("style",{nonce:e,href:Ze,precedence:"base-ui:low",children:`.${Ze}{scrollbar-width:none}.${Ze}::-webkit-scrollbar{display:none}`})}},So={...xn,...Rt},vo=s.forwardRef(function(t,n){const{render:o,className:u,style:p,finalFocus:r,...d}=t,{store:g,popupRef:i,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:I,selectedItemTextRef:C,multiple:U,handleScrollArrowVisibility:S,scrollHandlerRef:Y,listRef:L,highlightItemOnHover:T,floatingContext:M}=be(),{side:j,align:B,alignItemWithTriggerActive:N,isPositioned:q,setControlledAlignItemWithTrigger:O}=It(),ue=Bn()!=null,$=qn(),{nonce:le,disableStyleElements:K}=eo(),H=c(g,a.id),V=c(g,a.open),J=c(g,a.openMethod),R=c(g,a.mounted),ne=c(g,a.popupProps),_=c(g,a.transitionStatus),P=c(g,a.triggerElement),l=c(g,a.positionerElement),m=c(g,a.listElement),Q=s.useRef(!1),F=s.useRef(!1),oe=s.useRef({}),f=Pn(),v=He(E=>{if(!l||!i.current||!F.current)return;const X=l.style.top==="0px",z=l.style.bottom==="0px";if(Q.current||!N||!X&&!z){S(E);return}const de=Vt(l),Z=Xe(l.getBoundingClientRect().height,"y",de),se=xt(l),re=ft(l),ie=re.getComputedStyle(l),fe=parseFloat(ie.marginTop),W=parseFloat(ie.marginBottom),G=Pt(re.getComputedStyle(i.current)),ae=Math.min(se.documentElement.clientHeight-fe-W,G),A=E.scrollTop,Me=et(E);let ve=null;const ye=te=>{l.style.height=`${te}px`},ce=X?Me-A:A,je=Math.min(Z+ce,ae);if(ce<=ge){const te=$e(ce,0,ae-Z);te>0&&ye(Z+te),E.scrollTop=X?Me:0,ae-(Z+te)<=ge&&(Q.current=!0),S(E);return}if(ae-je>ge)ve=X?1/0:0;else if(z&&A<Me){const te=Z+ce-ae;ve=A-(ce-te)}const Ne=Math.ceil(je);if(Ne!==0&&ye(Ne),ve!=null){const te=$e(ve,0,et(E));Math.abs(E.scrollTop-te)>ge&&(E.scrollTop=te)}Ne>=ae-ge&&(Q.current=!0),S(E)});s.useImperativeHandle(Y,()=>v,[v]),it({open:V,ref:i,onComplete(){V&&x?.(!0)}});const D={open:V,transitionStatus:_,side:j,align:B};xe(()=>{!l||!i.current||Object.keys(oe.current).length||(oe.current={top:l.style.top||"0",left:l.style.left||"0",right:l.style.right,height:l.style.height,bottom:l.style.bottom,minHeight:l.style.minHeight,maxHeight:l.style.maxHeight,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom})},[i,l]),xe(()=>{V||N||(F.current=!1,Q.current=!1,lt(l,oe.current))},[V,N,l,i]),xe(()=>{const E=i.current;if(!V||!P||!l||!E||N&&!q||g.state.transitionStatus==="ending")return;if(F.current=!0,E.style.removeProperty("--transform-origin"),!N){f.request(()=>S(m||E));return}const X=yo(E);try{let z=C.current;z?.isConnected||(z=!a.hasSelectedValue(g.state)&&I.current?.isConnected?I.current:null);const de=y.current,Z=ft(l),se=Z.getComputedStyle(l),re=Z.getComputedStyle(E),ie=xt(P),fe=Vt(P),W=tt(P.getBoundingClientRect(),fe),G=tt(l.getBoundingClientRect(),fe),ae=W.height,A=m||E,Me=A.scrollHeight,ve=parseFloat(re.borderBottomWidth),ye=parseFloat(se.marginTop)||10,ce=parseFloat(se.marginBottom)||10,je=parseFloat(se.minHeight)||100,Ne=Pt(re),te=5,at=5,Ge=20,Re=ie.documentElement.clientHeight-ye-ce,ct=ie.documentElement.clientWidth,Ye=Re-W.bottom+ae;let me,De=$==="rtl"?W.right-G.width:W.left,ke=0;if(z&&de){const pe=tt(de.getBoundingClientRect(),fe);me=tt(z.getBoundingClientRect(),fe),De=G.left+($==="rtl"?pe.right-me.right:pe.left-me.left);const _e=pe.top-W.top+pe.height/2;ke=me.top-G.top+me.height/2-_e}const Ee=Ye+ke+ce+ve;let he=Math.min(Re,Ee);const Ae=Re-ye-ce,Ue=Ee-he,Be=ct-at;l.style.left=`${$e(De,te,Be-G.width)}px`,l.style.height=`${he}px`,l.style.maxHeight="none",l.style.marginTop=`${ye}px`,l.style.marginBottom=`${ce}px`,E.style.height="100%";const Ce=et(A),Oe=Ue>=Ce-ge;Oe&&(he=Math.min(Re,G.height)-(Ue-Ce));const Ke=W.top<Ge||W.bottom>Re-Ge||Math.ceil(he)+ge<Math.min(Me,je),Je=(Z.visualViewport?.scale??1)!==1&&gn;if(Ke||Je){lt(l,oe.current),O(!1);return}const Qe=Math.max(je,he);if(Oe){const pe=Math.max(0,Re-Ee);l.style.top=G.height>=Ae?"0":`${pe}px`,l.style.height=`${he}px`,A.scrollTop=et(A)}else l.style.bottom="0",A.scrollTop=Ue;if(me){const pe=G.top,_e=G.height,qe=me.top+me.height/2,ut=$e(_e>0?(qe-pe)/_e*100:50,0,100);E.style.setProperty("--transform-origin",`50% ${ut}%`)}(Qe===Re||he>=Ne)&&(Q.current=!0),S(A),T&&g.state.selectedIndex===null&&g.state.activeIndex===null&&L.current[0]!=null&&g.set("activeIndex",0)}finally{X()}},[g,V,l,P,y,I,C,i,S,N,O,f,m,L,T,$,q]),s.useEffect(()=>{if(!N||!l||!V)return;const E=ft(l);function X(z){b(!1,Ie(An,z))}return mn(E,"resize",X)},[b,N,l,V]);const ee={...m?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":U||void 0,id:`${H}-list`},onKeyDown(E){ue&&Vn.has(E.key)&&E.stopPropagation()},onScroll(E){m||v(E.currentTarget)},...N&&{style:m?{height:"100%"}:Wt},className:!m&&N?St.className:void 0},Se=Te("div",t,{ref:[n,i],state:D,stateAttributesMapping:So,props:[ne,ee,Wn(_),d]});return h.jsxs(s.Fragment,{children:[!K&&St.getElement(le),h.jsx(hn,{context:M,modal:!1,disabled:!R,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:Se})]})});function Pt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function et(e){return wt(e.scrollHeight,e.clientHeight)}function Vt(e){return _n.getScale(e)}function Xe(e,t,n){return e/n[t]}function tt(e,t){return zn({x:Xe(e.x,"x",t),y:Xe(e.y,"y",t),width:Xe(e.width,"x",t),height:Xe(e.height,"y",t)})}const jt=[["transform","none"],["scale","1"],["translate","0 0"]];function yo(e){const{style:t}=e,n={};for(const[o,u]of jt)n[o]=t.getPropertyValue(o),t.setProperty(o,u,"important");return()=>{for(const[o]of jt){const u=n[o];u?t.setProperty(o,u):t.removeProperty(o)}}}const Ro=s.forwardRef(function(t,n){const{render:o,className:u,style:p,...r}=t,{store:d,scrollHandlerRef:g,multiple:i}=be(),{alignItemWithTriggerActive:x}=It(),b=c(d,a.hasScrollArrows),y=c(d,a.openMethod),C={id:`${c(d,a.id)}-list`,role:"listbox","aria-multiselectable":i||void 0,onScroll(S){g.current?.(S.currentTarget)},...x&&{style:Wt},className:b&&y!=="touch"?St.className:void 0},U=d.useStateSetter("listElement");return Te("div",t,{ref:[n,U],props:[C,r]})}),Yt=s.createContext(void 0);function Tt(){const e=s.useContext(Yt);if(!e)throw new Error(vt(57));return e}const wo=s.memo(s.forwardRef(function(t,n){const{render:o,className:u,style:p,value:r=null,label:d,disabled:g=!1,nativeButton:i=!1,...x}=t,b=s.useRef(null),y=$n({guess:!0,label:d,textRef:b}),{store:I,itemProps:C,setOpen:U,setValue:S,selectionRef:Y,typingRef:L,valuesRef:T,multiple:M,selectedItemTextRef:j,disabled:B,readOnly:N}=be(),q=B||g,O=c(I,a.isActive,y.index),ue=c(I,a.open),$=c(I,a.isSelected,r),le=c(I,a.isSelectedByFocus,y.index),K=c(I,a.isItemEqualToValue),H=y.index,V=s.useRef(null);xe(()=>{const f=T.current;return f[H]=r,()=>{delete f[H]}},[H,r,T]),xe(()=>{const f=I.state.value;let v=f;M&&Array.isArray(f)&&(v=f.length>0?f[f.length-1]:void 0),v!==void 0&&We(r,v,K)&&(I.set("selectedIndex",H),b.current&&(j.current=b.current))},[H,M,K,I,r,j]);const J=s.useRef("mouse"),R=s.useRef(!1),{getButtonProps:ne,buttonRef:_}=Ot({disabled:q,focusableWhenDisabled:!0,native:i,composite:!0}),P={disabled:q,selected:$,highlighted:O};function l(f){if(B||N)return;const v=I.state.value;if(M){const D=Array.isArray(v)?v:[],ee=$?oo(D,r,K):[...D,r];S(ee,Ie(gt,f))}else S(r,Ie(gt,f)),U(!1,Ie(gt,f))}function m(){Y.current.dragY=0}const Q={role:"option","aria-selected":$,tabIndex:ue&&O?0:-1,onKeyDown(f){I.set("activeIndex",H),f.key===" "&&L.current&&f.preventDefault()},onClick(f){const v=J.current!=="touch",D=f.nativeEvent.pointerType,ee=v&&bn(f.nativeEvent)&&(D!==void 0||O),Se=v&&!ee&&!R.current;R.current=!1,!(q||Se)&&l(f.nativeEvent)},onPointerEnter(f){J.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){const v=Y.current;v.dragY+=f.movementY,v.dragY**2>=64&&(v.allowUnselectedMouseUp=!0)}},onPointerDown(f){J.current=f.pointerType,R.current=!0,m()},onMouseUp(){if(m(),q||J.current==="touch"||R.current)return;const f=!Y.current.allowSelectedMouseUp&&$,v=!Y.current.allowUnselectedMouseUp&&!$;f||v||(R.current=!0,V.current?.click(),R.current=!1)}},F=Te("div",t,{ref:[_,n,y.ref,V],state:P,props:[C,Q,x,ne]}),oe=s.useMemo(()=>({selected:$,index:H,textRef:b,selectedByFocus:le}),[$,H,b,le]);return h.jsx(Yt.Provider,{value:oe,children:F})})),Io=s.forwardRef(function(t,n){const{selected:o}=Tt();return t.keepMounted||o?h.jsx(To,{...t,ref:n}):null}),To=s.memo(s.forwardRef((e,t)=>{const{render:n,className:o,style:u,keepMounted:p,...r}=e,{selected:d}=Tt(),g=s.useRef(null),{transitionStatus:i,setMounted:x}=yt(d),y=Te("span",e,{ref:[t,g],state:{selected:d,transitionStatus:i},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Rt});return it({open:d,ref:g,onComplete(){d||x(!1)}}),y})),Mo=s.memo(s.forwardRef(function(t,n){const{index:o,textRef:u,selectedByFocus:p}=Tt(),{firstItemTextRef:r,selectedItemTextRef:d}=be(),{render:g,className:i,style:x,...b}=t,y=s.useCallback(C=>{C&&(o===0&&(r.current=C),p&&(d.current=C))},[r,d,o,p]);return Te("div",t,{ref:[y,n,u],props:b})})),qt=s.forwardRef(function(t,n){const{render:o,className:u,style:p,direction:r,keepMounted:d,...g}=t,i=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:I,scrollArrowsMountedCountRef:C}=be(),{side:U,scrollDownArrowRef:S,scrollUpArrowRef:Y}=It(),L=i?a.scrollUpArrowVisible:a.scrollDownArrowVisible,T=c(x,L),M=c(x,a.openMethod),j=T&&M!=="touch",B=nt(),N=i?Y:S,{mounted:q,transitionStatus:O,setMounted:ue}=yt(j);xe(()=>(C.current+=1,x.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&x.set("hasScrollArrows",!1)}),[x,C]),it({open:j,ref:N,onComplete(){j||ue(!1)}});const K=Te("div",t,{ref:[n,N],state:{direction:r,visible:j,side:U,transitionStatus:O},props:[{"aria-hidden":!0,children:i?"▲":"▼",style:{position:"absolute"},onMouseMove(V){if(V.movementX===0&&V.movementY===0||B.isStarted())return;x.set("activeIndex",null);function J(){const R=x.state.listElement??b.current;if(!R)return;x.set("activeIndex",null),I(R);const ne=wt(R.scrollHeight,R.clientHeight),_=rt(R.scrollTop,ne),P=_===(i?0:ne),l=y.current;if(_!==R.scrollTop&&(R.scrollTop=_),P){B.clear();return}if(l.length>0){const m=N.current?.offsetHeight||0;R.scrollTop=Eo(l,i,_,R.clientHeight,m,ne)}B.start(40,J)}B.start(40,J)},onMouseLeave(){B.clear()}},g],stateAttributesMapping:Rt});return q||d?K:null});function Eo(e,t,n,o,u,p){if(t){let x=0;const b=n+u-ge;for(let C=0;C<e.length;C+=1){const U=e[C];if(U&&U.offsetTop>=b){x=C;break}}const y=Math.max(0,x-1),I=e[y];return y<x&&I?rt(I.offsetTop-u,p):0}let r=e.length-1;const d=n+o-u+ge;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>d){r=Math.max(0,x-1);break}}const g=Math.min(e.length-1,r+1),i=e[g];return g>r&&i?rt(i.offsetTop+i.offsetHeight-o+u,p):p}const Ao=s.forwardRef(function(t,n){return h.jsx(qt,{...t,ref:n,direction:"down"})}),Co=s.forwardRef(function(t,n){return h.jsx(qt,{...t,ref:n,direction:"up"})}),Po=io;function Vo({className:e,...t}){return h.jsx(go,{"data-slot":"select-value",className:Fe("flex flex-1 text-left",e),...t})}function jo({className:e,size:t="default",children:n,...o}){return h.jsxs(fo,{"data-slot":"select-trigger","data-size":t,className:Fe("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[n,h.jsx(mo,{render:h.jsx(Lt,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function No({className:e,children:t,side:n="bottom",sideOffset:o=4,align:u="center",alignOffset:p=0,alignItemWithTrigger:r=!0,...d}){return h.jsx(ho,{children:h.jsx(bo,{side:n,sideOffset:o,align:u,alignOffset:p,alignItemWithTrigger:r,className:"isolate z-50",children:h.jsxs(vo,{"data-slot":"select-content","data-align-trigger":r,className:Fe("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...d,children:[h.jsx(Lo,{}),h.jsx(Ro,{children:t}),h.jsx(Ho,{})]})})})}function Oo({className:e,children:t,...n}){return h.jsxs(wo,{"data-slot":"select-item",className:Fe("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[h.jsx(Mo,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),h.jsx(Io,{render:h.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:h.jsx(Qt,{className:"pointer-events-none"})})]})}function Lo({className:e,...t}){return h.jsx(Co,{"data-slot":"select-scroll-up-button",className:Fe("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(Gn,{})})}function Ho({className:e,...t}){return h.jsx(Ao,{"data-slot":"select-scroll-down-button",className:Fe("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(Lt,{})})}const mt="__none__";function Xo({id:e,value:t,onChange:n,options:o,className:u,size:p="default","aria-label":r,placeholder:d="Choose…"}){const g=o.map(i=>({value:i.value===""?mt:i.value,label:i.label}));return h.jsxs(Po,{items:g,value:t===""?mt:t,onValueChange:i=>i!=null&&n(i===mt?"":String(i)),children:[h.jsx(jo,{id:e,size:p,"aria-label":r,className:Fe("w-full bg-card",u),children:h.jsx(Vo,{children:i=>{const x=g.find(b=>b.value===i);return x?x.label:h.jsx("span",{className:"text-muted-foreground",children:d})}})}),h.jsx(No,{children:g.map(i=>h.jsx(Oo,{value:i.value,children:i.label},i.value))})]})}export{Xo as P,Po as S,jo as a,Vo as b,No as c,Oo as d};
|
|
6
|
+
*/const Xn=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gn=Xt("chevron-up",Xn);function Kn(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,u=vn(),p=Qt()!=null,r=Lt(()=>new en({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new tn,floatingId:u,syncOnly:!1,nested:p})).current;return xe(()=>{const d={open:t,floatingId:u};o.reference!==void 0&&(d.referenceElement=o.reference,d.domReferenceElement=Gt(o.reference)?o.reference:null),o.floating!==void 0&&(d.floatingElement=o.floating),r.update(d)},[t,u,o.reference,o.floating,r]),r.context.onOpenChange=n,r.context.nested=p,r}function Jn(e){const[t,n]=s.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}const Zn=s.createContext(void 0),Qn={disableStyleElements:!1};function eo(){return s.useContext(Zn)??Qn}function to(e){const t=s.useRef(!0);t.current&&(t.current=!1,e())}const kt=s.createContext(null);function be(){const e=s.useContext(kt);if(e===null)throw new Error(vt(60));return e}const no=(e,t)=>Object.is(e,t);function We(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:We(o,t,n))}function oo(e,t,n){return e.filter(o=>!We(t,o,n))}function Ut(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function so(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(Ut(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function Bt(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return bt(e)}function ze(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?bt(e.value):bt(e)}function _t(e,t,n){function o(){return Bt(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const u=t,p=Ut(u)?u.flatMap(r=>r.items):u;if(e==null||typeof e!="object"){const r=p.find(d=>d.value===e);return r&&r.label!=null?r.label:o()}if("value"in e){const r=p.find(d=>d&&d.value===e.value);if(r&&r.label!=null)return r.label}}return o()}function ro(e,t,n){return e.reduce((o,u,p)=>(p>0&&o.push(", "),o.push(h.jsx(s.Fragment,{children:_t(u,t,n)},p)),o),[])}const a={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:ze(t,o)!==""},hasNullItemLabel:(e,t)=>t?so(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(u=>We(t,u,n)):We(t,o,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function lo(e,t,n=(o,u)=>o===u){return e.length===t.length&&e.every((o,u)=>n(o,t[u]))}function qe(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const ge=1;function wt(e,t){return Math.max(0,e-t)}function rt(e,t){if(t<=0)return 0;const n=qe(e,0,t),o=n,u=t-n,p=o<=ge,r=u<=ge;return p&&r?o<=u?0:t:p?0:r?t:n}function io(e){const{id:t,value:n,defaultValue:o=null,onValueChange:u,open:p,defaultOpen:r=!1,onOpenChange:d,name:g,form:i,autoComplete:x,disabled:b=!1,readOnly:y=!1,required:I=!1,modal:C=!0,actionsRef:U,inputRef:S,onOpenChangeComplete:Y,items:O,multiple:T=!1,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B=no,highlightItemOnHover:L=!0,children:$}=e,{clearErrors:N}=yn(),{setDirty:ue,setTouched:q,setFocused:le,validityData:K,setFilled:H,name:V,disabled:J,validation:R,validationMode:ne}=Ft(),_=Dt({id:t}),P=J||b,l=V??g,[m,Z]=Ct({controlled:n,default:T?o??At:o,name:"Select",state:"value"}),[F,oe]=Ct({controlled:p,default:r,name:"Select",state:"open"}),f=s.useRef([]),v=s.useRef([]),D=s.useRef(null),ee=s.useRef(null),Se=s.useRef(0),E=s.useRef(null),X=s.useRef([]),z=s.useRef(!1),de=s.useRef(null),Q=s.useRef(null),se=s.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),re=s.useRef(!1),{mounted:ie,setMounted:fe,transitionStatus:W}=yt(F),{openMethod:G,triggerProps:ae}=Ln(F),A=Lt(()=>new nn({id:_,labelId:void 0,modal:C,multiple:T,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B,value:m,open:F,mounted:ie,transitionStatus:W,items:O,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Me=c(A,a.activeIndex),ve=c(A,a.selectedIndex),ye=c(A,a.triggerElement),ce=c(A,a.positionerElement),je=Jn(G),Le=G??je,te=s.useMemo(()=>T?"":ze(m,j),[T,m,j]),at=s.useMemo(()=>T&&Array.isArray(m)?m.map(w=>ze(w,j)):ze(m,j),[T,m,j]),Ge=Ht(ye),Re=He(()=>at);Rn(Ge,_,m,Re,!P,g);const ct=s.useRef(m),Ye=T?Array.isArray(m)&&m.length>0:m!=null&&te!=="";xe(()=>{H(Ye)},[Ye,H]),xe(function(){let k=m,we=!1;if(T){const Oe=Array.isArray(m)?m:[];we=Oe.length===0,k=Oe[Oe.length-1]}const Pe=we?-1:ot(X.current,k,B),Ve=Pe===-1?null:Pe;Ve===null&&(Q.current=null),!F&&A.set("selectedIndex",Ve)},[T,F,m,B,A]);function me(w){const k=K.initialValue;return Array.isArray(w)&&Array.isArray(k)?!lo(w,k,(we,Pe)=>We(we,Pe,B)):w!==k}jn(m,()=>{N(l),ue(me(m)),R.change(m)});const De=He((w,k)=>{d?.(w,k),!k.isCanceled&&(oe(w),!w&&(k.reason===wn||k.reason===In)&&(q(!0),le(!1),ne==="onBlur"&&R.commit(m)))}),ke=He(()=>{fe(!1),A.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),Y?.(!1)});it({enabled:!U,open:F,ref:D,onComplete(){F||ke()}}),s.useImperativeHandle(U,()=>({unmount:ke}),[ke]);const Ee=He((w,k)=>{u?.(w,k),!k.isCanceled&&Z(w)}),he=He(w=>{const k=wt(w.scrollHeight,w.clientHeight),we=rt(w.scrollTop,k),Pe=we>0,Ve=we<k;A.set("scrollUpArrowVisible",Pe),A.set("scrollDownArrowVisible",Ve)}),Ae=Kn({open:F,onOpenChange:De,elements:{reference:ye,floating:ce}}),Ue=Nn(Ae,{enabled:!y&&!P,event:"mousedown"}),Be=on(Ae),Ce=On(Ae,{enabled:!y&&!P,listRef:f,activeIndex:Me,selectedIndex:ve,disabledIndices:At,onNavigate(w){w===null&&!F||A.set("activeIndex",w)},focusItemOnHover:L}),Ne=Hn(Ae,{enabled:!y&&!P&&(F||!T),listRef:v,activeIndex:Me,selectedIndex:ve,disabledIndices:w=>Sn(f.current[w]),onMatch(w){F?A.set("activeIndex",w):Ee(X.current[w],Ie(st))},onTyping(w){z.current=w}}),Ke=s.useMemo(()=>ht(Ne.reference,Ce.reference,Be.reference,Ue.reference,ae),[Ue.reference,Ne.reference,Ce.reference,Be.reference,ae]),Je=s.useMemo(()=>ht(sn,Ne.floating,Ce.floating,Be.floating),[Ne.floating,Ce.floating,Be.floating]),Ze=Ce.item??Kt;to(()=>{A.update({popupProps:Je,triggerProps:Ke})}),A.useSyncedValues({id:_,modal:C,multiple:T,value:m,open:F,mounted:ie,transitionStatus:W,popupProps:Je,triggerProps:Ke,items:O,itemToStringLabel:M,itemToStringValue:j,isItemEqualToValue:B,openMethod:Le});const pe=s.useMemo(()=>({store:A,floatingContext:Ae,required:I,disabled:P,readOnly:y,multiple:T,highlightItemOnHover:L,setValue:Ee,setOpen:De,listRef:f,popupRef:D,scrollHandlerRef:ee,handleScrollArrowVisibility:he,scrollArrowsMountedCountRef:Se,itemProps:Ze,valueRef:E,valuesRef:X,labelsRef:v,typingRef:z,selectionRef:se,firstItemTextRef:de,selectedItemTextRef:Q,validation:R,onOpenChangeComplete:Y,alignItemWithTriggerActiveRef:re,initialValueRef:ct}),[A,Ae,I,P,y,T,L,Ee,De,Ze,R,Y,he]),_e=Jt(S,R.inputRef),$e=T?void 0:l,ut=s.useMemo(()=>!T||!Array.isArray(m)||!l?null:m.map(w=>{const k=ze(w,j);return h.jsx("input",{type:"hidden",form:i,name:l,value:k,disabled:P},k)}),[T,m,i,l,j,P]);return h.jsxs(kt.Provider,{value:pe,children:[$,h.jsx("input",{...R.getValidationProps(P,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(w){if(w.nativeEvent.defaultPrevented||P||y)return;const k=w.currentTarget.value,we=Ie(st,w.nativeEvent);function Pe(){if(T)return;const Ve=k.toLowerCase();let Oe=X.current.findIndex(dt=>ze(dt,j).toLowerCase()===Ve||Bt(dt,M).toLowerCase()===Ve);Oe===-1&&(Oe=X.current.findIndex((dt,qt)=>{const Et=v.current[qt];return Et!=null&&Et.toLowerCase()===Ve}));const Mt=X.current[Oe];Mt!=null&&Ee(Mt,we)}A.set("forceMount",!0),queueMicrotask(Pe)}}),id:_&&$e==null?`${_}-hidden-input`:void 0,form:i,name:$e,autoComplete:x,value:te,disabled:P,required:I&&!(T&&Ye),readOnly:y,ref:_e,style:l?rn:ln,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ut]})}function ao(e,t){return e??t}const co=400,uo={...cn,...Mn,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},fo=s.forwardRef(function(t,n){const{render:o,className:u,id:p,disabled:r=!1,nativeButton:d=!0,style:g,...i}=t,{setTouched:x,setFocused:b,validationMode:y,state:I,disabled:C}=Ft(),{labelId:U}=Tn(),{store:S,setOpen:Y,selectionRef:O,validation:T,readOnly:M,required:j,alignItemWithTriggerActiveRef:B,disabled:L}=be(),$=C||L||r,N=c(S,a.open),ue=c(S,a.mounted),q=c(S,a.value),le=c(S,a.triggerProps),K=c(S,a.positionerElement),H=c(S,a.listElement),V=c(S,a.popupSide),J=c(S,a.id),R=c(S,a.labelId),ne=c(S,a.hasSelectedValue),_=ue&&K?V:null,P=p??J,l=ao(U,R);Dt({id:P});const m=Ht(K),Z=s.useRef(null),{getButtonProps:F,buttonRef:oe}=Nt({disabled:$,native:d}),f=S.useStateSetter("triggerElement"),v=nt(),D=nt(),ee=nt();s.useEffect(()=>{if(N)return ee.start(co,()=>{O.current.allowUnselectedMouseUp=!0,O.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};O.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},D.clear()},[N,O,D,ee]);const Se=ht(le,{id:P,role:"combobox","aria-expanded":N,"aria-haspopup":"listbox","aria-controls":N?H?.id??an(K)?.id:void 0,"aria-labelledby":l,"aria-readonly":M||void 0,"aria-required":j||void 0,tabIndex:$?-1:0,onFocus(z){b(!0),N&&B.current&&Y(!1,Ie(st,z.nativeEvent)),v.start(0,()=>{S.set("forceMount",!0)})},onBlur(z){pt(K,z.relatedTarget)||(x(!0),b(!1),y==="onBlur"&&T.commit(q))},onMouseDown(z){if(N)return;const de=xt(z.currentTarget);function Q(se){if(!Z.current)return;const re=se.target;pt(Z.current,re)||pt(m.current,re)||Fn(se,Z.current)||Y(!1,Ie(En,se))}D.start(0,()=>{de.addEventListener("mouseup",Q,{once:!0})})}},i,F),E=T.getValidationProps($,Se);E.role="combobox";const X={...I,open:N,disabled:$,value:q,readOnly:M,popupSide:_,placeholder:!ne};return Te("button",t,{ref:[n,Z,oe,f],state:X,stateAttributesMapping:uo,props:E})}),po={value:()=>null},go=s.forwardRef(function(t,n){const{className:o,render:u,children:p,placeholder:r,style:d,...g}=t,{store:i,valueRef:x}=be(),b=c(i,a.value),y=c(i,a.items),I=c(i,a.itemToStringLabel),C=c(i,a.hasSelectedValue),U=!C&&r!=null&&p==null,S=c(i,a.hasNullItemLabel,U),Y={value:b,placeholder:!C};let O=null;return typeof p=="function"?O=p(b):p!=null?O=p:U&&!S?O=r:Array.isArray(b)?O=ro(b,y,I):O=_t(b,y,I),Te("span",t,{state:Y,ref:[n,x],props:[{children:O},g],stateAttributesMapping:po})}),mo=s.forwardRef(function(t,n){const{render:o,className:u,style:p,...r}=t,{store:d}=be(),i={open:c(d,a.open)};return Te("span",t,{state:i,ref:n,props:[{"aria-hidden":!0,children:"▼"},r],stateAttributesMapping:un})}),ho=s.forwardRef(function(t,n){const{store:o}=be(),u=c(o,a.mounted),p=c(o,a.forceMount);return u||p?h.jsx(dn,{ref:n,...t}):null}),zt=s.createContext(void 0);function It(){const e=s.useContext(zt);if(!e)throw new Error(vt(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const Wt={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},xo={position:"fixed"},bo=s.forwardRef(function(t,n){const{anchor:o,className:u,render:p,positionMethod:r,side:d,align:g,sideOffset:i,alignOffset:x,collisionBoundary:b="clipping-ancestors",collisionPadding:y,arrowPadding:I,sticky:C,disableAnchorTracking:U,alignItemWithTrigger:S=!0,collisionAvoidance:Y=fn,style:O,...T}=t,{store:M,listRef:j,labelsRef:B,alignItemWithTriggerActiveRef:L,selectedItemTextRef:$,valuesRef:N,initialValueRef:ue,popupRef:q,setValue:le,floatingContext:K}=be(),H=c(M,a.open),V=c(M,a.mounted),J=c(M,a.modal),R=c(M,a.value),ne=c(M,a.openMethod),_=c(M,a.positionerElement),P=c(M,a.triggerElement),l=c(M,a.isItemEqualToValue),m=c(M,a.transitionStatus),Z=s.useRef(null),F=s.useRef(null),[oe,f]=s.useState(S),v=V&&oe&&ne!=="touch";!V&&oe!==S&&f(S),s.useImperativeHandle(L,()=>v),Dn((v||J)&&H,ne==="touch",_,P);const D=kn({anchor:o,floatingRootContext:K,positionMethod:r,mounted:V,side:d,sideOffset:i,align:g,alignOffset:x,arrowPadding:I,collisionBoundary:b,collisionPadding:y,sticky:C,disableAnchorTracking:U??v,collisionAvoidance:Y,keepMounted:!0}),ee=v?"none":D.side,Se=v?xo:D.positionerStyles,E={open:H,side:ee,align:D.align,anchorHidden:D.anchorHidden};xe(()=>{M.set("popupSide",D.side)},[M,D.side]);const X=M.useStateSetter("positionerElement"),z=Un(t,E,{styles:Se,transitionStatus:m,props:T,refs:[n,X],hidden:!V,inert:!H}),de=s.useRef(0),Q=He(re=>{if(N.current.length===0)return;const ie=de.current;if(de.current=re.size,re.size===ie)return;const fe=Ie(st);if(ie!==0&&!M.state.multiple&&R!==null&&ot(N.current,R,l)===-1){const G=ue.current,A=G!=null&&ot(N.current,G,l)!==-1?G:null;le(A,fe),A===null&&(M.set("selectedIndex",null),$.current=null)}if(ie!==0&&M.state.multiple&&Array.isArray(R)){const W=R.filter(G=>ot(N.current,G,l)!==-1);W.length!==R.length&&(le(W,fe),W.length===0&&(M.set("selectedIndex",null),$.current=null))}if(H&&v){M.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const W={height:""};lt(_,W),lt(q.current,W)}}),se=s.useMemo(()=>({...D,side:ee,alignItemWithTriggerActive:v,setControlledAlignItemWithTrigger:f,scrollUpArrowRef:Z,scrollDownArrowRef:F}),[D,ee,v,f]);return h.jsx(Yn,{elementsRef:j,labelsRef:B,onMapChange:Q,children:h.jsxs(zt.Provider,{value:se,children:[V&&J&&h.jsx(pn,{inert:Cn(!H),cutout:P}),z]})})}),Qe="base-ui-disable-scrollbar",St={className:Qe,getElement(e){return h.jsx("style",{nonce:e,href:Qe,precedence:"base-ui:low",children:`.${Qe}{scrollbar-width:none}.${Qe}::-webkit-scrollbar{display:none}`})}},So={...xn,...Rt},vo=s.forwardRef(function(t,n){const{render:o,className:u,style:p,finalFocus:r,...d}=t,{store:g,popupRef:i,onOpenChangeComplete:x,setOpen:b,valueRef:y,firstItemTextRef:I,selectedItemTextRef:C,multiple:U,handleScrollArrowVisibility:S,scrollHandlerRef:Y,listRef:O,highlightItemOnHover:T,floatingContext:M}=be(),{side:j,align:B,alignItemWithTriggerActive:L,isPositioned:$,setControlledAlignItemWithTrigger:N}=It(),ue=Bn()!=null,q=$n(),{nonce:le,disableStyleElements:K}=eo(),H=c(g,a.id),V=c(g,a.open),J=c(g,a.openMethod),R=c(g,a.mounted),ne=c(g,a.popupProps),_=c(g,a.transitionStatus),P=c(g,a.triggerElement),l=c(g,a.positionerElement),m=c(g,a.listElement),Z=s.useRef(!1),F=s.useRef(!1),oe=s.useRef({}),f=Pn(),v=He(E=>{if(!l||!i.current||!F.current)return;const X=l.style.top==="0px",z=l.style.bottom==="0px";if(Z.current||!L||!X&&!z){S(E);return}const de=Vt(l),Q=Xe(l.getBoundingClientRect().height,"y",de),se=xt(l),re=ft(l),ie=re.getComputedStyle(l),fe=parseFloat(ie.marginTop),W=parseFloat(ie.marginBottom),G=Pt(re.getComputedStyle(i.current)),ae=Math.min(se.documentElement.clientHeight-fe-W,G),A=E.scrollTop,Me=et(E);let ve=null;const ye=te=>{l.style.height=`${te}px`},ce=X?Me-A:A,je=Math.min(Q+ce,ae);if(ce<=ge){const te=qe(ce,0,ae-Q);te>0&&ye(Q+te),E.scrollTop=X?Me:0,ae-(Q+te)<=ge&&(Z.current=!0),S(E);return}if(ae-je>ge)ve=X?1/0:0;else if(z&&A<Me){const te=Q+ce-ae;ve=A-(ce-te)}const Le=Math.ceil(je);if(Le!==0&&ye(Le),ve!=null){const te=qe(ve,0,et(E));Math.abs(E.scrollTop-te)>ge&&(E.scrollTop=te)}Le>=ae-ge&&(Z.current=!0),S(E)});s.useImperativeHandle(Y,()=>v,[v]),it({open:V,ref:i,onComplete(){V&&x?.(!0)}});const D={open:V,transitionStatus:_,side:j,align:B};xe(()=>{!l||!i.current||Object.keys(oe.current).length||(oe.current={top:l.style.top||"0",left:l.style.left||"0",right:l.style.right,height:l.style.height,bottom:l.style.bottom,minHeight:l.style.minHeight,maxHeight:l.style.maxHeight,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom})},[i,l]),xe(()=>{V||L||(F.current=!1,Z.current=!1,lt(l,oe.current))},[V,L,l,i]),xe(()=>{const E=i.current;if(!V||!P||!l||!E||L&&!$||g.state.transitionStatus==="ending")return;if(F.current=!0,E.style.removeProperty("--transform-origin"),!L){f.request(()=>S(m||E));return}const X=yo(E);try{let z=C.current;z?.isConnected||(z=!a.hasSelectedValue(g.state)&&I.current?.isConnected?I.current:null);const de=y.current,Q=ft(l),se=Q.getComputedStyle(l),re=Q.getComputedStyle(E),ie=xt(P),fe=Vt(P),W=tt(P.getBoundingClientRect(),fe),G=tt(l.getBoundingClientRect(),fe),ae=W.height,A=m||E,Me=A.scrollHeight,ve=parseFloat(re.borderBottomWidth),ye=parseFloat(se.marginTop)||10,ce=parseFloat(se.marginBottom)||10,je=parseFloat(se.minHeight)||100,Le=Pt(re),te=5,at=5,Ge=20,Re=ie.documentElement.clientHeight-ye-ce,ct=ie.documentElement.clientWidth,Ye=Re-W.bottom+ae;let me,De=q==="rtl"?W.right-G.width:W.left,ke=0;if(z&&de){const pe=tt(de.getBoundingClientRect(),fe);me=tt(z.getBoundingClientRect(),fe),De=G.left+(q==="rtl"?pe.right-me.right:pe.left-me.left);const _e=pe.top-W.top+pe.height/2;ke=me.top-G.top+me.height/2-_e}const Ee=Ye+ke+ce+ve;let he=Math.min(Re,Ee);const Ae=Re-ye-ce,Ue=Ee-he,Be=ct-at;l.style.left=`${qe(De,te,Be-G.width)}px`,l.style.height=`${he}px`,l.style.maxHeight="none",l.style.marginTop=`${ye}px`,l.style.marginBottom=`${ce}px`,E.style.height="100%";const Ce=et(A),Ne=Ue>=Ce-ge;Ne&&(he=Math.min(Re,G.height)-(Ue-Ce));const Ke=W.top<Ge||W.bottom>Re-Ge||Math.ceil(he)+ge<Math.min(Me,je),Je=(Q.visualViewport?.scale??1)!==1&&gn;if(Ke||Je){lt(l,oe.current),N(!1);return}const Ze=Math.max(je,he);if(Ne){const pe=Math.max(0,Re-Ee);l.style.top=G.height>=Ae?"0":`${pe}px`,l.style.height=`${he}px`,A.scrollTop=et(A)}else l.style.bottom="0",A.scrollTop=Ue;if(me){const pe=G.top,_e=G.height,$e=me.top+me.height/2,ut=qe(_e>0?($e-pe)/_e*100:50,0,100);E.style.setProperty("--transform-origin",`50% ${ut}%`)}(Ze===Re||he>=Le)&&(Z.current=!0),S(A),T&&g.state.selectedIndex===null&&g.state.activeIndex===null&&O.current[0]!=null&&g.set("activeIndex",0)}finally{X()}},[g,V,l,P,y,I,C,i,S,L,N,f,m,O,T,q,$]),s.useEffect(()=>{if(!L||!l||!V)return;const E=ft(l);function X(z){b(!1,Ie(An,z))}return mn(E,"resize",X)},[b,L,l,V]);const ee={...m?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":U||void 0,id:`${H}-list`},onKeyDown(E){ue&&Vn.has(E.key)&&E.stopPropagation()},onScroll(E){m||v(E.currentTarget)},...L&&{style:m?{height:"100%"}:Wt},className:!m&&L?St.className:void 0},Se=Te("div",t,{ref:[n,i],state:D,stateAttributesMapping:So,props:[ne,ee,Wn(_),d]});return h.jsxs(s.Fragment,{children:[!K&&St.getElement(le),h.jsx(hn,{context:M,modal:!1,disabled:!R,openInteractionType:J,returnFocus:r,restoreFocus:!0,children:Se})]})});function Pt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function et(e){return wt(e.scrollHeight,e.clientHeight)}function Vt(e){return _n.getScale(e)}function Xe(e,t,n){return e/n[t]}function tt(e,t){return zn({x:Xe(e.x,"x",t),y:Xe(e.y,"y",t),width:Xe(e.width,"x",t),height:Xe(e.height,"y",t)})}const jt=[["transform","none"],["scale","1"],["translate","0 0"]];function yo(e){const{style:t}=e,n={};for(const[o,u]of jt)n[o]=t.getPropertyValue(o),t.setProperty(o,u,"important");return()=>{for(const[o]of jt){const u=n[o];u?t.setProperty(o,u):t.removeProperty(o)}}}const Ro=s.forwardRef(function(t,n){const{render:o,className:u,style:p,...r}=t,{store:d,scrollHandlerRef:g,multiple:i}=be(),{alignItemWithTriggerActive:x}=It(),b=c(d,a.hasScrollArrows),y=c(d,a.openMethod),C={id:`${c(d,a.id)}-list`,role:"listbox","aria-multiselectable":i||void 0,onScroll(S){g.current?.(S.currentTarget)},...x&&{style:Wt},className:b&&y!=="touch"?St.className:void 0},U=d.useStateSetter("listElement");return Te("div",t,{ref:[n,U],props:[C,r]})}),Yt=s.createContext(void 0);function Tt(){const e=s.useContext(Yt);if(!e)throw new Error(vt(57));return e}const wo=s.memo(s.forwardRef(function(t,n){const{render:o,className:u,style:p,value:r=null,label:d,disabled:g=!1,nativeButton:i=!1,...x}=t,b=s.useRef(null),y=qn({guess:!0,label:d,textRef:b}),{store:I,itemProps:C,setOpen:U,setValue:S,selectionRef:Y,typingRef:O,valuesRef:T,multiple:M,selectedItemTextRef:j,disabled:B,readOnly:L}=be(),$=B||g,N=c(I,a.isActive,y.index),ue=c(I,a.open),q=c(I,a.isSelected,r),le=c(I,a.isSelectedByFocus,y.index),K=c(I,a.isItemEqualToValue),H=y.index,V=s.useRef(null);xe(()=>{const f=T.current;return f[H]=r,()=>{delete f[H]}},[H,r,T]),xe(()=>{const f=I.state.value;let v=f;M&&Array.isArray(f)&&(v=f.length>0?f[f.length-1]:void 0),v!==void 0&&We(r,v,K)&&(I.set("selectedIndex",H),b.current&&(j.current=b.current))},[H,M,K,I,r,j]);const J=s.useRef("mouse"),R=s.useRef(!1),{getButtonProps:ne,buttonRef:_}=Nt({disabled:$,focusableWhenDisabled:!0,native:i,composite:!0}),P={disabled:$,selected:q,highlighted:N};function l(f){if(B||L)return;const v=I.state.value;if(M){const D=Array.isArray(v)?v:[],ee=q?oo(D,r,K):[...D,r];S(ee,Ie(gt,f))}else S(r,Ie(gt,f)),U(!1,Ie(gt,f))}function m(){Y.current.dragY=0}const Z={role:"option","aria-selected":q,tabIndex:ue&&N?0:-1,onKeyDown(f){I.set("activeIndex",H),f.key===" "&&O.current&&f.preventDefault()},onClick(f){const v=J.current!=="touch",D=f.nativeEvent.pointerType,ee=v&&bn(f.nativeEvent)&&(D!==void 0||N),Se=v&&!ee&&!R.current;R.current=!1,!($||Se)&&l(f.nativeEvent)},onPointerEnter(f){J.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){const v=Y.current;v.dragY+=f.movementY,v.dragY**2>=64&&(v.allowUnselectedMouseUp=!0)}},onPointerDown(f){J.current=f.pointerType,R.current=!0,m()},onMouseUp(){if(m(),$||J.current==="touch"||R.current)return;const f=!Y.current.allowSelectedMouseUp&&q,v=!Y.current.allowUnselectedMouseUp&&!q;f||v||(R.current=!0,V.current?.click(),R.current=!1)}},F=Te("div",t,{ref:[_,n,y.ref,V],state:P,props:[C,Z,x,ne]}),oe=s.useMemo(()=>({selected:q,index:H,textRef:b,selectedByFocus:le}),[q,H,b,le]);return h.jsx(Yt.Provider,{value:oe,children:F})})),Io=s.forwardRef(function(t,n){const{selected:o}=Tt();return t.keepMounted||o?h.jsx(To,{...t,ref:n}):null}),To=s.memo(s.forwardRef((e,t)=>{const{render:n,className:o,style:u,keepMounted:p,...r}=e,{selected:d}=Tt(),g=s.useRef(null),{transitionStatus:i,setMounted:x}=yt(d),y=Te("span",e,{ref:[t,g],state:{selected:d,transitionStatus:i},props:[{"aria-hidden":!0,children:"✔️"},r],stateAttributesMapping:Rt});return it({open:d,ref:g,onComplete(){d||x(!1)}}),y})),Mo=s.memo(s.forwardRef(function(t,n){const{index:o,textRef:u,selectedByFocus:p}=Tt(),{firstItemTextRef:r,selectedItemTextRef:d}=be(),{render:g,className:i,style:x,...b}=t,y=s.useCallback(C=>{C&&(o===0&&(r.current=C),p&&(d.current=C))},[r,d,o,p]);return Te("div",t,{ref:[y,n,u],props:b})})),$t=s.forwardRef(function(t,n){const{render:o,className:u,style:p,direction:r,keepMounted:d,...g}=t,i=r==="up",{store:x,popupRef:b,listRef:y,handleScrollArrowVisibility:I,scrollArrowsMountedCountRef:C}=be(),{side:U,scrollDownArrowRef:S,scrollUpArrowRef:Y}=It(),O=i?a.scrollUpArrowVisible:a.scrollDownArrowVisible,T=c(x,O),M=c(x,a.openMethod),j=T&&M!=="touch",B=nt(),L=i?Y:S,{mounted:$,transitionStatus:N,setMounted:ue}=yt(j);xe(()=>(C.current+=1,x.set("hasScrollArrows",!0),()=>{C.current=Math.max(0,C.current-1),C.current===0&&x.set("hasScrollArrows",!1)}),[x,C]),it({open:j,ref:L,onComplete(){j||ue(!1)}});const K=Te("div",t,{ref:[n,L],state:{direction:r,visible:j,side:U,transitionStatus:N},props:[{"aria-hidden":!0,children:i?"▲":"▼",style:{position:"absolute"},onMouseMove(V){if(V.movementX===0&&V.movementY===0||B.isStarted())return;x.set("activeIndex",null);function J(){const R=x.state.listElement??b.current;if(!R)return;x.set("activeIndex",null),I(R);const ne=wt(R.scrollHeight,R.clientHeight),_=rt(R.scrollTop,ne),P=_===(i?0:ne),l=y.current;if(_!==R.scrollTop&&(R.scrollTop=_),P){B.clear();return}if(l.length>0){const m=L.current?.offsetHeight||0;R.scrollTop=Eo(l,i,_,R.clientHeight,m,ne)}B.start(40,J)}B.start(40,J)},onMouseLeave(){B.clear()}},g],stateAttributesMapping:Rt});return $||d?K:null});function Eo(e,t,n,o,u,p){if(t){let x=0;const b=n+u-ge;for(let C=0;C<e.length;C+=1){const U=e[C];if(U&&U.offsetTop>=b){x=C;break}}const y=Math.max(0,x-1),I=e[y];return y<x&&I?rt(I.offsetTop-u,p):0}let r=e.length-1;const d=n+o-u+ge;for(let x=0;x<e.length;x+=1){const b=e[x];if(b&&b.offsetTop+b.offsetHeight>d){r=Math.max(0,x-1);break}}const g=Math.min(e.length-1,r+1),i=e[g];return g>r&&i?rt(i.offsetTop+i.offsetHeight-o+u,p):p}const Ao=s.forwardRef(function(t,n){return h.jsx($t,{...t,ref:n,direction:"down"})}),Co=s.forwardRef(function(t,n){return h.jsx($t,{...t,ref:n,direction:"up"})}),Po=io;function Vo({className:e,...t}){return h.jsx(go,{"data-slot":"select-value",className:Fe("flex flex-1 text-left",e),...t})}function jo({className:e,size:t="default",children:n,...o}){return h.jsxs(fo,{"data-slot":"select-trigger","data-size":t,className:Fe("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[n,h.jsx(mo,{render:h.jsx(Ot,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Lo({className:e,children:t,side:n="bottom",sideOffset:o=4,align:u="center",alignOffset:p=0,alignItemWithTrigger:r=!0,...d}){return h.jsx(ho,{children:h.jsx(bo,{side:n,sideOffset:o,align:u,alignOffset:p,alignItemWithTrigger:r,className:"isolate z-50",children:h.jsxs(vo,{"data-slot":"select-content","data-align-trigger":r,className:Fe("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...d,children:[h.jsx(Oo,{}),h.jsx(Ro,{children:t}),h.jsx(Ho,{})]})})})}function No({className:e,children:t,...n}){return h.jsxs(wo,{"data-slot":"select-item",className:Fe("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[h.jsx(Mo,{className:"flex flex-1 shrink-0 gap-2 whitespace-nowrap",children:t}),h.jsx(Io,{render:h.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:h.jsx(Zt,{className:"pointer-events-none"})})]})}function Oo({className:e,...t}){return h.jsx(Co,{"data-slot":"select-scroll-up-button",className:Fe("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(Gn,{})})}function Ho({className:e,...t}){return h.jsx(Ao,{"data-slot":"select-scroll-down-button",className:Fe("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:h.jsx(Ot,{})})}const mt="__none__";function Xo({id:e,value:t,onChange:n,options:o,className:u,size:p="default","aria-label":r,placeholder:d="Choose…"}){const g=o.map(i=>({value:i.value===""?mt:i.value,label:i.label}));return h.jsxs(Po,{items:g,value:t===""?mt:t,onValueChange:i=>i!=null&&n(i===mt?"":String(i)),children:[h.jsx(jo,{id:e,size:p,"aria-label":r,className:Fe("w-full bg-card",u),children:h.jsx(Vo,{children:i=>{const x=g.find(b=>b.value===i);return x?x.label:h.jsx("span",{className:"text-muted-foreground",children:d})}})}),h.jsx(Lo,{children:g.map(i=>h.jsx(No,{value:i.value,children:i.label},i.value))})]})}export{Xo as P,Po as S,jo as a,Vo as b,Lo as c,No as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,j as e,
|
|
1
|
+
import{r,j as e,al as o}from"./index-CUBD0DcL.js";function u({saving:s,savedAt:t}){const[i,a]=r.useState(!1);return r.useEffect(()=>{if(!t)return;a(!0);const n=setTimeout(()=>a(!1),1800);return()=>clearTimeout(n)},[t]),s?e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[12.5px] text-muted-foreground","aria-live":"polite",children:[e.jsx(o,{className:"size-3.5 animate-spin","aria-hidden":"true"}),"Saving"]}):e.jsx("span",{className:"text-[12.5px] text-muted-foreground","aria-live":"polite",children:i?"Saved":""})}export{u as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{N as o}from"./index-CUBD0DcL.js";const n=o;export{n as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{N as o}from"./index-CUBD0DcL.js";const t=o;export{t as notFoundComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,u as n,G as a,B as r}from"./index-
|
|
1
|
+
import{j as e,u as n,G as a,B as r}from"./index-CUBD0DcL.js";function i({error:s}){const t=n(),o=s instanceof Error?s.message:"Something went wrong.";return e.jsx(a,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3",children:[e.jsx("h1",{className:"m-0 text-lg font-semibold",children:"Could not load the dashboard"}),e.jsx("p",{className:"m-0 text-muted-foreground",children:o}),e.jsx(r,{variant:"outline",size:"sm",onClick:()=>void t.invalidate(),children:"Try again"})]})})}const m=({error:s})=>e.jsx(i,{error:s});export{m as errorComponent};
|